在ARM开发板上实现LCD+USB键盘
一、LCD驱动
二、USB键盘驱动
/** Copyright 2002 Red Hat Inc., Durham, North Carolina.** All Rights Reserved.** Permission is hereby granted, free of charge, to any person obtaining* a copy of this software and associated documentation files (the* "Software"), to deal in the Software without restriction, including* without limitation on the rights to use, copy, modify, merge,* publish, distribute, sublicense, and/or sell copies of the Software,* and to permit persons to whom the Software is furnished to do so,* subject to the following conditions:** The above copyright notice and this permission notice (including the* next paragraph) shall be included in all copies or substantial* portions of the Software.** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND* NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE* SOFTWARE.** This is a simple test program that reads from /dev/input/event*,* decoding events into a human readable form.*//** Authors:* Rickard E. (Rik) Faith <faith@redhat.com>**/#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
#include <time.h>
#include <linux/input.h>struct input_event event;int main(int argc, char **argv)
{char name[64]; /* RATS: Use ok, but could be better */char buf[256] = { 0, }; /* RATS: Use ok */unsigned char mask[EV_MAX/8 + 1]; /* RATS: Use ok */int version;int fd = 0;int rc;int i, j;char *tmp;#define test_bit(bit) (mask[(bit)/8] & (1 << ((bit)%8)))for (i = 0; i < 32; i++) {sprintf(name, "/dev/event%d", i);if ((fd = open(name, O_RDONLY, 0)) >= 0) {ioctl(fd, EVIOCGVERSION, &version);ioctl(fd, EVIOCGNAME(sizeof(buf)), buf);ioctl(fd, EVIOCGBIT(0, sizeof(mask)), mask);printf("%s\n", name);printf(" evdev version: %d.%d.%d\n",version >> 16, (version >> 8) & 0xff, version & 0xff);printf(" name: %s\n", buf);printf(" features:");for (j = 0; j < EV_MAX; j++) {if (test_bit(j)) {const char *type = "unknown";switch(j) {case EV_KEY: type = "keys/buttons"; break;case EV_REL: type = "relative"; break;case EV_ABS: type = "absolute"; break;case EV_MSC: type = "reserved"; break;case EV_LED: type = "leds"; break;case EV_SND: type = "sound"; break;case EV_REP: type = "repeat"; break;case EV_FF: type = "feedback"; break;}printf(" %s", type);}}printf("\n");close(fd);}}if (argc > 1) {sprintf(name, "/dev/event%d", atoi(argv[1]));if ((fd = open(name, O_RDWR, 0)) >= 0) {printf("%s: open, fd = %d\n", name, fd);for (i = 0; i < LED_MAX; i++) {event.time.tv_sec = time(0);event.time.tv_usec = 0;event.type = EV_LED;event.code = i;event.value = 0;write(fd, &event, sizeof(event));}while ((rc = read(fd, &event, sizeof(event))) > 0) {printf("%-24.24s.%06lu type 0x%04x; code 0x%04x;"" value 0x%08x; ",ctime(&event.time.tv_sec),event.time.tv_usec,event.type, event.code, event.value);switch (event.type) {case EV_KEY:if (event.code > BTN_MISC) {printf("Button %d %s",event.code & 0xff,event.value ? "press" : "release");} else {printf("Key %d (0x%x) %s",event.code & 0xff,event.code & 0xff,event.value ? "press" : "release");}break;case EV_REL:switch (event.code) {case REL_X: tmp = "X"; break;case REL_Y: tmp = "Y"; break;case REL_HWHEEL: tmp = "HWHEEL"; break;case REL_DIAL: tmp = "DIAL"; break;case REL_WHEEL: tmp = "WHEEL"; break;case REL_MISC: tmp = "MISC"; break;default: tmp = "UNKNOWN"; break;}printf("Relative %s %d", tmp, event.value);break;case EV_ABS:switch (event.code) {case ABS_X: tmp = "X"; break;case ABS_Y: tmp = "Y"; break;case ABS_Z: tmp = "Z"; break;case ABS_RX: tmp = "RX"; break;case ABS_RY: tmp = "RY"; break;case ABS_RZ: tmp = "RZ"; break;case ABS_THROTTLE: tmp = "THROTTLE"; break;case ABS_RUDDER: tmp = "RUDDER"; break;case ABS_WHEEL: tmp = "WHEEL"; break;case ABS_GAS: tmp = "GAS"; break;case ABS_BRAKE: tmp = "BRAKE"; break;case ABS_HAT0X: tmp = "HAT0X"; break;case ABS_HAT0Y: tmp = "HAT0Y"; break;case ABS_HAT1X: tmp = "HAT1X"; break;case ABS_HAT1Y: tmp = "HAT1Y"; break;case ABS_HAT2X: tmp = "HAT2X"; break;case ABS_HAT2Y: tmp = "HAT2Y"; break;case ABS_HAT3X: tmp = "HAT3X"; break;case ABS_HAT3Y: tmp = "HAT3Y"; break;case ABS_PRESSURE: tmp = "PRESSURE"; break;case ABS_DISTANCE: tmp = "DISTANCE"; break;case ABS_TILT_X: tmp = "TILT_X"; break;case ABS_TILT_Y: tmp = "TILT_Y"; break;case ABS_MISC: tmp = "MISC"; break;default: tmp = "UNKNOWN"; break;}printf("Absolute %s %d", tmp, event.value);break;case EV_MSC: printf("Misc"); break;case EV_LED: printf("Led"); break;case EV_SND: printf("Snd"); break;case EV_REP: printf("Rep"); break;case EV_FF: printf("FF"); break;break;}printf("\n");}printf("rc = %d, (%s)\n", rc, strerror(errno));close(fd);}}return 0;
}
这是在内核里边找到的一个关于usbkbd驱动的测试程序,运行后,按键打印出:
按1
Thu Jan 1 00:17:51 1970.825874 type 0x0001; code 0x0002; value 0x00000001; Key 2 (0x2) press
Thu Jan 1 00:17:51 1970.825897 type 0x0000; code 0x0000; value 0x00000000;
Thu Jan 1 00:17:51 1970.961856 type 0x0001; code 0x0002; value 0x00000000; Key 2 (0x2) release
Thu Jan 1 00:17:51 1970.961874 type 0x0000; code 0x0000; value 0x00000000;
按2
Thu Jan 1 00:17:53 1970.217894 type 0x0001; code 0x0003; value 0x00000001; Key 3 (0x3) press
Thu Jan 1 00:17:53 1970.217917 type 0x0000; code 0x0000; value 0x00000000;
Thu Jan 1 00:17:53 1970.361883 type 0x0001; code 0x0003; value 0x00000000; Key 3 (0x3) release
Thu Jan 1 00:17:53 1970.361902 type 0x0000; code 0x0000; value 0x00000000;
按3
Thu Jan 1 00:17:54 1970.649916 type 0x0001; code 0x0004; value 0x00000001; Key 4 (0x4) press
Thu Jan 1 00:17:54 1970.649938 type 0x0000; code 0x0000; value 0x00000000;
Thu Jan 1 00:17:54 1970.785891 type 0x0001; code 0x0004; value 0x00000000; Key 4 (0x4) release
Thu Jan 1 00:17:54 1970.785911 type 0x0000; code 0x0000; value 0x00000000;
2———在Graphics support-->support for frame buffer devices-->console display driver support-->
select compiled-in fonts 选择合适的字体。
在ARM开发板上实现LCD+USB键盘相关推荐
- 将linux内核烧进arm板,ARM开发板上uClinux内核移植
<ARM开发板上uClinux内核移植>由会员分享,可在线阅读,更多相关<ARM开发板上uClinux内核移植(19页珍藏版)>请在人人文库网上搜索. 1.纷傲掌秀悸篷益哑檀扬 ...
- 摄像头在liunx上的QT显示和OK6410 ARM开发板上的使用
摄像头在liunx上的QT显示和OK6410 ARM开发板上的使用 发布者:旺旺雪饼 时间:2013-01-05 16:56:09 环境: Ubuntu10.04 arm linux OS: 3. ...
- 【linux】ARM开发板上设置RTC时间,断电重启后,设置失效的原因分析
问题描述 linux中使用date设置时间后用hwclock -w同步到RTC,断电重启后,有时会失效 原因分析 保存时间戳 1.使用命令关机(halt)会调用rc0.d中的脚本: 2.使用命令重启( ...
- 如何在ARM开发板上从源码编译安装OpenCV和OpenCV contrib
点击上方"3D视觉工坊",选择"星标" 干货第一时间送达 本文主要介绍如何在ARM开发板上从源码编译安装OpenCV和OpenCV contrib. OpenC ...
- ARM开发板上iconv_open(utf-8, gb2312) 调用失败的解决方法(转)
ARM开发板上iconv_open("utf-8", "gb2312") 调用失败的解决方法 应用程序代码如下: static int code_convert ...
- linux usb视频开发板,ARM开发板上USB 摄像头图像采集实现
开发板上的arm是AT91RM9200,摄像头选用的是网眼的pc350,主控芯片是ov511+.系统内核是2.4,宿主机是fedora core 6,交叉编译器是2.95.3.就是这些家底了,:-). ...
- 在arm开发板上实现播放内存里所有的jpg和bmp格式图片
之前学习的时候一个作业,趁机会发表一下做个记录,bmp图片较为简单就可以实现了,关于bmp图片的原理可参考这个链接https://blog.csdn.net/u013066730/article/de ...
- python交叉编译_交叉编译Python3.6.2,使用海思arm-hisiv200-linux-gcc,移植到arm开发板上...
最近在学习Python,感觉使用Python可以快速的写出程序,比之前使用的C语言快多了,能省出很多时间.多学一点知识有更多的选择.本职工作是嵌入式开发,学习了Python后想移植到开发板上,尝试嵌入 ...
- 4G上网模块ME3760移植到arm开发板上(6410)
花了一天时间终于让6410开发板ping通www.baidu.com了,下面分享给大家.希望大家少走弯路~ 我不知道是不是因为ME3760 V2这个4G模块太偏了,网上没有一个成熟详细的移植教 ...
最新文章
- c js html页面进度条,js实现进度条的方法
- 不是吧!程序员今年在相亲市场上这么受欢迎?
- 爬虫五 Beautifulsoup模块详细
- 如何学好算法与程序设计
- 【学术相关】普通在读奶爸博士生的一年总结!
- 定时覆盖库_高考直通车公众号 联考题库大全
- html怎么用ui打开,HTML5教程 如何使用原生UI
- 抓住眼球的美食海报模板|总有设计技法,吸引住你
- windows下对hid设备interrupt端口读写_读《汇编语言》第三版 第十四章 端口
- 在html中加入滚动条,html滚动条 textarea属性设置
- python一元线性回归算法_手写算法—Python代码实现一元线性回归
- 隐藏IP地址的三种方法
- TapTap Android电话面经
- 更新品牌与Z世代交互方式|朋氪元宇宙即将内测
- 苹果开发者账号(三)
- php168整站系统官网,PHP168整站系统官方下载
- 数据库保存数据,类型为List<String>
- sa结构组网方式_5g组网SA和NSA的区别是啥?
- 【愚公系列】2022年02月 U3D全栈班 007-制作设置天空盒资源
- 题解 P2285 【[HNOI2004]打鼹鼠】