阅读:1302回复:2
为什么我的USB键盘不能工作?
用cypress的开发板做了一个USB键盘
我原本以为运行后就能够象ps2键盘一样工作 结果计算机上没有任何动静 我想发的数据倒是发送成功了 难道键盘还需要驱动么?我认为是不要的 至少win2000和98se不要 整个firmware是在cypress的fw下改出来的 请大家帮我看一下,是firmware没写对还是我对USB键盘的理解有问题 谢谢了 以下是我的发送代码 void TD_Poll(void) // Called repeatedly while the device is idle { BYTE count, i; if( !(EPIO[IN1BUF_ID].cntrl & bmEPBUSY) ) // Is the IN2BUF available, { // Then loopback the data for(i=0;i<8;++i) IN1BUF = 0; if(led_num==0) IN1BUF[2]=0x04;//我想连续发送a键 EPIO[IN1BUF_ID].bytes =8; } led_num++;//这个循环一定次数后发送一次a键 } 以下是IntrfcDscr: db IntrfcDscrEnd-IntrfcDscr ;; Descriptor length db DSCR_INTRFC ;; Descriptor type db 0 ;; Zero-based index of this interface db 0 ;; Alternate setting db 1 ;; Number of end points db 03H ;; Interface class db 01H ;; Interface sub class db 01H ;; Interface sub sub class db 0 ;; Interface descriptor string index IntrfcDscrEnd: HIDDscr: db 9 ;; Length db 21H ;; Type db 10H, 01H ;; HID class spec.# compliance (0110 = 1.1) db 0 ;; Country localization (0=none) db 1 ;; Number of descriptors to follow (excluding endpoint) db 22H ;; Descriptor type to follow (report) db ReportDscrEnd - ReportDscr, 0 ;; Report descriptor length HIDDscrEnd: ;;EpO2Dscr: ;; db EpO2DscrEnd-EpO2Dscr ;; Descriptor length ;; db DSCR_ENDPNT ;; Descriptor type ;; db 00000010b ;; Endpoint number, and direction ;; db ET_INT ;; Endpoint type ;; db 08H ;; Maximun packet size (LSB) ;; db 00H ;; Max packect size (MSB) ;; db 10 ;; Polling interval ;;EpO2DscrEnd: EpI1Dscr: db EpI1DscrEnd-EpI1Dscr ;; Descriptor length db DSCR_ENDPNT ;; Descriptor type db 10000001b ;; Endpoint number, and direction db ET_INT ;; Endpoint type db 08H ;; Maximun packet size (LSB) db 00H ;; Max packect size (MSB) db 10 ;; Polling interval EpI1DscrEnd: EpAllDscrEnd: ReportDscr: db 05H, 01H ;; Usage Page (Generic Desktop) db 09H, 06H ;; Usage (Keyboard) db 0A1H, 01H ;; Collection (Application) ;; Modifier Byte db 05H, 07H ;; Usage (Key Codes) db 19H, 00H ;; Usage Min Modifier Code db 29H, 0E7H ;; Usage Max Modifier Code db 15H, 00H ;; Logical minimum (0) db 25H, 01H ;; Logical maximum (1) db 75H, 01H ;; Report size (1 bits) db 95H, 08H ;; Report count (8 fields) db 81H, 02H ;; Input modifer byte ;; Reserved Byte db 95H, 01H ;; Report Count db 75H, 08H ;; Report Size db 81H, 01H ;; Input Reserved byte ;;LED byte db 95h, 05h ;; Report Count; db 75h, 01h ;; Report Size db 05h, 08h ;; Usage (page # for LEDs) db 19h, 01h ;; Usage Min(1) db 29h, 05h ;; Usage Max(5) db 91h, 02h ;; Output (Data,Variable,Absolute) db 95h, 01h ;; Report Size db 75h, 03h ;; Report Count db 91h, 01h ;; Output (Constant) ;;Key Arrays (6 bytes) db 95h, 06h ;; Report Size (6) db 75h, 08h ;; Report Count(8) db 15h, 00h ;; Logical Min (0) db 25h, 65h ;; Logical Max (101) db 05h, 07h ;; Usage page(Key Codes) db 19h, 00h ;; Usage Min (0) db 29h, 65h ;; Usage Max (101) db 81h, 00h ;; Key Arrays (6 bytes) ;; End Collection (Application) db 0C0H ReportDscrEnd:HID 设置和Report |
|
沙发#
发布于:2002-11-18 08:39
有一 点可以确定,你只要你的设备做的符合规范。系统就会自动识别你的设备,首先确保你的硬件没有问题,再子细看看你的各种描符述没有问题,我想你就会成功!
|
|
板凳#
发布于:2002-11-18 09:24
识别符应该是没有问题
在计算机的系统硬件里面已经出现了USB人体功能设备 而且类似我上面的程序我另外做过一个 不过那个是自定义的HID接口 我可以不需要驱动程序直接在应用程序里面找到这个设备 并进行读写 现在我是想做成一个类似与USB键盘的冬冬 这样连特定的应用程序都不需要就可以直接接入系统 并完成一些简单的控制功能了(不就是一键盘吗!!) 可是我模拟不停发送A键 计算机的应用程序(比如word什么的)压根就不理我 这是怎回事哪? 请继续赐教 |
|