阅读:1318回复:0
为什么我的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键 } 以下是设置和Report 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 |
|
最新喜欢:abei11 |