374獲取設(shè)備描述符有問題

UINT8 GetDeviceDescr( PUINT8 buf ) // 獲取設(shè)備描述符 { UINT8 s, len; UsbDevEndpSize = DEFAULT_ENDP0_SIZE; s = HostCtrlTransfer374( SetupGetDevDescr, buf, &len ); // 執(zhí)行控制傳輸 if ( s == USB_INT_SUCCESS ) { UsbDevEndpSize =((PUSB_DEV_DESCR)buf )-> bMaxPacketSize0; // 端點(diǎn)0最大包長(zhǎng)度,這是簡(jiǎn)化處理,正常應(yīng)該先獲取前8字節(jié)后立即更新UsbDevEndpSize再繼續(xù) if ( len < ( (PUSB_SETUP_REQ)SetupGetDevDescr ) -> wLengthL ) s = USB_INT_BUF_OVER; // 描述符長(zhǎng)度錯(cuò)誤 } return( s ); }

請(qǐng)教一下,現(xiàn)有一個(gè)產(chǎn)品不能 獲取設(shè)備描述符,用了上面的程式 下面的看了很長(zhǎng)時(shí)間,不是太理解: // 端點(diǎn)0最大包長(zhǎng)度,這是簡(jiǎn)化處理,正常應(yīng)該先獲取前8字節(jié)后立即更新UsbDevEndpSize再繼續(xù)

這個(gè)沒有簡(jiǎn)化處理的應(yīng)怎么寫,給一個(gè)例程,謝謝!

這個(gè)簡(jiǎn)化處理的獲取設(shè)備描述符的程序是可以獲取到描述符的,沒簡(jiǎn)化的只是需要先更新端點(diǎn)大小再獲取剩余的描述符。你是獲取什么設(shè)備的描述符?返回錯(cuò)誤代碼是什么?


鍵盤,大多的鍵盤都可以,就這個(gè)不行(用的芯片不同),返回的為32(0x20);


那你看一下這個(gè)鍵盤和其他鍵盤有什么區(qū)別?返回0x20是應(yīng)答超時(shí),說明設(shè)備沒有給主機(jī)應(yīng)答或者應(yīng)答錯(cuò)誤


Bus Hound 3.02 capture. Complements of www.perisoft.net

ng

Dev - Device ID Time - Elapsed time since the start of the previous Phase Phase - ADDR= 1394 transfer address LOCK= 1394 lock transaction CDB = Command block NSTS= NT status CTL = USB control packet RSET= bus reset DI = Data In RSTS= I/O Request Status DO = Data Out SNS = SCSI Sense Data IDE = IDE task file command SSTS= SCSI Request Block Status ISOC= Isochronous Transfer USTS= USB status

(10) USB Root Hub (11) Intel(R) N10/ICH7 Family USB Universal Host Controller - 27CA (18) USB Composite Device (19) USB 人體學(xué)輸入設(shè)備

Dev Phase Data Info Time Cmd.Phase.Ofs --- ----- ----------------------------------------------------- ---------------- ----- ------------------ 18 DI 00 00 00 00 - a0 66 8e f7 .....f.. 0us 1.1.0 18 USTS 00 70 00 c0 error 2us 1.2.0 19 DI 00 00 00 00 - a0 66 8e f7 .....f.. 1us 2.1.0 19 USTS 00 70 00 c0 error 1us 2.2.0 18 USTS 00 70 00 c0 error 2.1sc 3.1.0 18 USTS 00 70 00 c0 error 512ms 4.1.0 19 USTS 00 70 00 c0 error 3us 5.1.0 18 CTL 80 06 00 01 - 00 00 12 00 GET DESCRIPTR 853ms 6.1.0 18 DI 12 01 10 01 - 00 00 00 08 - 2c 1a 21 0c - 10 01 01 02 ........,.!..... 5.9ms 6.2.0 00 01 .. 6.2.16 18 CTL 80 06 00 02 - 00 00 09 00 GET DESCRIPTR 10us 7.1.0 18 DI 09 02 3b 00 - 02 01 00 a0 - 32 ..;.....2 4.9ms 7.2.0 18 CTL 80 06 00 02 - 00 00 3b 00 GET DESCRIPTR 7us 8.1.0 18 DI 09 02 3b 00 - 02 01 00 a0 - 32 09 04 00 - 00 01 03 01 ..;.....2....... 10ms 8.2.0 01 00 09 21 - 10 01 00 01 - 22 36 00 07 - 05 81 03 08 ...!...."6...... 8.2.16 00 0a 09 04 - 01 00 01 03 - 01 02 00 09 - 21 10 01 00 ............!... 8.2.32 01 22 6c 00 - 07 05 82 03 - 05 00 0a ."l........ 8.2.48 18 CTL 00 09 01 00 - 00 00 00 00 SET CONFIG 16us 9.1.0 18 USTS 00 03 00 80 parm invalid 37ms 10.1.0 18 CTL 80 06 00 03 - 00 00 ff 00 GET DESCRIPTR 376us 11.1.0 18 DI 04 03 09 04 .... 4.8ms 11.2.0 18 CTL 80 06 02 03 - 09 04 ff 00 GET DESCRIPTR 13us 12.1.0 18 DI 1a 03 55 00 - 53 00 42 00 - 20 00 4b 00 - 65 00 79 00 ..U.S.B. .K.e.y. 7.9ms 12.2.0 62 00 6f 00 - 61 00 72 00 - 64 00 b.o.a.r.d. 12.2.16 18 CTL 80 06 00 03 - 00 00 ff 00 GET DESCRIPTR 23us 13.1.0 18 DI 04 03 09 04 .... 4.9ms 13.2.0 18 CTL 80 06 02 03 - 09 04 ff 00 GET DESCRIPTR 11us 14.1.0 18 DI 1a 03 55 00 - 53 00 42 00 - 20 00 4b 00 - 65 00 79 00 ..U.S.B. .K.e.y. 7.9ms 14.2.0 62 00 6f 00 - 61 00 72 00 - 64 00 b.o.a.r.d. 14.2.16 18 CTL 80 06 00 03 - 00 00 ff 00 GET DESCRIPTR 1.3ms 15.1.0 18 DI 04 03 09 04 .... 4.6ms 15.2.0 18 CTL 80 06 02 03 - 09 04 ff 00 GET DESCRIPTR 13us 16.1.0 18 DI 1a 03 55 00 - 53 00 42 00 - 20 00 4b 00 - 65 00 79 00 ..U.S.B. .K.e.y. 7.9ms 16.2.0 62 00 6f 00 - 61 00 72 00 - 64 00 b.o.a.r.d. 16.2.16 18 CTL 80 06 00 03 - 00 00 ff 00 GET DESCRIPTR 24us 17.1.0 18 DI 04 03 09 04 .... 4.9ms 17.2.0 18 CTL 80 06 02 03 - 09 04 ff 00 GET DESCRIPTR 10us 18.1.0 18 DI 1a 03 55 00 - 53 00 42 00 - 20 00 4b 00 - 65 00 79 00 ..U.S.B. .K.e.y. 7.9ms 18.2.0 62 00 6f 00 - 61 00 72 00 - 64 00 b.o.a.r.d. 18.2.16 19 CTL 80 06 00 01 - 00 00 12 00 GET DESCRIPTR 1.6ms 19.1.0 19 DO 12 01 10 01 - 00 00 00 08 - 2c 1a 21 0c - 10 01 01 02 ........,.!..... 3us 19.2.0 00 01 .. 19.2.16 19 CTL 80 06 00 02 - 00 00 09 00 GET DESCRIPTR 3us 20.1.0 19 DO 09 02 22 00 - 01 01 00 a0 - 32 ..".....2 2us 20.2.0 19 CTL 80 06 00 02 - 00 00 22 00 GET DESCRIPTR 2us 21.1.0 19 DO 09 02 22 00 - 01 01 00 a0 - 32 09 04 00 - 00 01 03 01 ..".....2....... 1us 21.2.0 01 00 09 21 - 10 01 00 01 - 22 36 00 07 - 05 81 03 08 ...!...."6...... 21.2.16 00 0a .. 21.2.32 19 CTL 00 09 01 00 - 00 00 00 00 SET CONFIG 3us 22.1.0 19 CTL 21 0a 00 00 - 00 00 00 00 CLASS 3us 23.1.0 18 CTL 21 0a 00 00 - 00 00 00 00 CLASS 2us 24.1.0 19 CTL 80 06 00 22 - 00 00 76 00 GET DESCRIPTR 2.3ms 25.1.0 18 CTL 80 06 00 22 - 00 00 76 00 GET DESCRIPTR 12us 26.1.0 18 DI 05 01 09 06 - a1 01 05 08 - 19 01 29 03 - 15 00 25 01 ..........)...%. 10ms 26.2.0 75 01 95 03 - 91 02 95 05 - 91 01 05 07 - 19 e0 29 e7 u.............). 26.2.16 95 08 81 02 - 75 08 95 01 - 81 01 19 00 - 29 91 26 ff ....u.......).&. 26.2.32 00 95 06 81 - 00 c0 ...... 26.2.48 19 DI 05 01 09 06 - a1 01 05 08 - 19 01 29 03 - 15 00 25 01 ..........)...%. 3us 25.2.0 75 01 95 03 - 91 02 95 05 - 91 01 05 07 - 19 e0 29 e7 u.............). 25.2.16 95 08 81 02 - 75 08 95 01 - 81 01 19 00 - 29 91 26 ff ....u.......).&. 25.2.32 00 95 06 81 - 00 c0 ...... 25.2.48 18 CTL 21 0a 00 00 - 01 00 00 00 CLASS 2.1ms 27.1.0 18 CTL 80 06 00 22 - 01 00 ac 00 GET DESCRIPTR 2.8ms 28.1.0 18 DI 05 01 09 02 - a1 01 85 03 - 09 01 a1 00 - 05 09 19 01 ................ 17ms 28.2.0 29 03 15 00 - 25 01 95 03 - 75 01 81 02 - 95 01 75 05 )...%...u.....u. 28.2.16 81 01 05 01 - 09 30 09 31 - 09 38 15 81 - 25 7f 75 08 .....0.1.8..%.u. 28.2.32 95 03 81 06 - c0 c0 05 01 - 09 80 a1 01 - 85 02 19 81 ................ 28.2.48 29 83 15 00 - 25 01 75 01 - 95 03 81 02 - 75 01 95 05 )...%.u.....u... 28.2.64 81 01 c0 05 - 0c 09 01 a1 - 01 85 01 19 - 00 2a 3c 02 .............*<. 28.2.80 15 00 26 3c - 02 95 01 75 - 10 81 00 c0 ..&<...u.... 28.2.96 19 CTL 21 09 00 02 - 00 00 01 00 CLASS 1.0sc 29.1.0 18 CTL 21 09 00 02 - 00 00 01 00 CLASS 9us 30.1.0 18 DO 01 . 3.4ms 30.2.0 19 DO 01 . 3us 29.2.0 18 DI 00 00 00 00 - 00 00 00 00 ........ 7.9ms 31.1.0 19 DI 00 00 00 00 - 00 00 00 00 ........ 2us 32.1.0


Bus Hound 3.02 capture. Complements of www.perisoft.net

ok

Dev - Device ID Time - Elapsed time since the start of the previous Phase Phase - ADDR= 1394 transfer address LOCK= 1394 lock transaction CDB = Command block NSTS= NT status CTL = USB control packet RSET= bus reset DI = Data In RSTS= I/O Request Status DO = Data Out SNS = SCSI Sense Data IDE = IDE task file command SSTS= SCSI Request Block Status ISOC= Isochronous Transfer USTS= USB status

(10) USB Root Hub [4KB/Sec] (11) Intel(R) N10/ICH7 Family USB Universal Host Controller - 27CA (18) USB Composite Device (19) USB 人體學(xué)輸入設(shè)備

Dev Phase Data Info Time Cmd.Phase.Ofs --- ----- ----------------------------------------------------- ---------------- ----- ------------------ 10 USTS 00 70 00 c0 error 0us 1.1.0 10 CTL a3 00 00 00 - 02 00 04 00 CLASS 172ms 2.1.0 10 DI 01 03 01 00 .... 20us 2.2.0 10 CTL a3 00 00 00 - 02 00 04 00 CLASS 10us 3.1.0 10 DI 01 03 01 00 .... 24us 3.2.0 10 CTL 23 01 10 00 - 02 00 00 00 CLASS 13us 4.1.0 10 CTL a3 00 00 00 - 01 00 04 00 CLASS 148us 5.1.0 10 DI 08 00 00 00 .... 11us 5.2.0 10 CTL a3 00 00 00 - 02 00 04 00 CLASS 7us 6.1.0 10 DI 01 03 00 00 .... 10us 6.2.0 10 CTL a3 00 00 00 - 02 00 04 00 CLASS 115ms 7.1.0 10 DI 01 03 00 00 .... 32us 7.2.0 10 CTL 23 03 04 00 - 02 00 00 00 CLASS 14us 8.1.0 10 CTL a3 00 00 00 - 02 00 04 00 CLASS 26ms 9.1.0 10 DI 03 03 10 00 .... 25us 9.2.0 10 CTL 23 01 14 00 - 02 00 00 00 CLASS 2us 10.1.0 10 CTL a3 00 00 00 - 02 00 04 00 CLASS 26ms 11.1.0 10 DI 03 03 00 00 .... 31us 11.2.0 10 CTL a3 00 00 00 - 02 00 04 00 CLASS 24ms 12.1.0 10 DI 03 03 00 00 .... 30us 12.2.0 10 CTL 23 03 04 00 - 02 00 00 00 CLASS 14us 13.1.0 10 CTL a3 00 00 00 - 02 00 04 00 CLASS 26ms 14.1.0 10 DI 03 03 10 00 .... 25us 14.2.0 10 CTL 23 01 14 00 - 02 00 00 00 CLASS 2us 15.1.0 10 CTL 80 06 00 02 - 00 00 ff 00 GET DESCRIPTR 83ms 16.1.0 10 DI 09 02 22 00 - 01 01 00 a0 - 32 09 04 00 - 00 01 03 01 ..".....2....... 8.8ms 16.2.0 01 00 09 21 - 10 01 00 01 - 22 41 00 07 - 05 81 03 08 ...!...."A...... 16.2.16 00 0a .. 16.2.32 10 CTL 80 06 00 03 - 00 00 ff 00 GET DESCRIPTR 135us 17.1.0 10 DI 04 03 09 04 .... 4.8ms 17.2.0 10 CTL 80 06 02 03 - 09 04 ff 00 GET DESCRIPTR 29us 18.1.0 10 DI 2e 03 44 00 - 65 00 6c 00 - 6c 00 20 00 - 51 00 75 00 ..D.e.l.l. .Q.u. 9.8ms 18.2.0 69 00 65 00 - 74 00 4b 00 - 65 00 79 00 - 20 00 4b 00 i.e.t.K.e.y. .K. 18.2.16 65 00 79 00 - 62 00 6f 00 - 61 00 72 00 - 64 00 e.y.b.o.a.r.d. 18.2.32 10 CTL 80 06 00 03 - 00 00 ff 00 GET DESCRIPTR 27us 19.1.0 10 DI 04 03 09 04 .... 4.9ms 19.2.0 10 CTL 80 06 02 03 - 09 04 ff 00 GET DESCRIPTR 19us 20.1.0 10 DI 2e 03 44 00 - 65 00 6c 00 - 6c 00 20 00 - 51 00 75 00 ..D.e.l.l. .Q.u. 9.9ms 20.2.0 69 00 65 00 - 74 00 4b 00 - 65 00 79 00 - 20 00 4b 00 i.e.t.K.e.y. .K. 20.2.16 65 00 79 00 - 62 00 6f 00 - 61 00 72 00 - 64 00 e.y.b.o.a.r.d. 20.2.32 10 CTL 80 06 00 01 - 00 00 12 00 GET DESCRIPTR 3.1ms 21.1.0 10 DI 12 01 10 01 - 00 00 00 08 - 3c 41 06 21 - 01 01 01 02 ........ 00 01 .. 21.2.16 10 CTL 80 06 00 02 - 00 00 09 00 GET DESCRIPTR 20us 22.1.0 10 DI 09 02 22 00 - 01 01 00 a0 - 32 ..".....2 4.9ms 22.2.0 10 CTL 80 06 00 02 - 00 00 22 00 GET DESCRIPTR 16us 23.1.0 10 DI 09 02 22 00 - 01 01 00 a0 - 32 09 04 00 - 00 01 03 01 ..".....2....... 7.9ms 23.2.0 01 00 09 21 - 10 01 00 01 - 22 41 00 07 - 05 81 03 08 ...!...."A...... 23.2.16 00 0a .. 23.2.32 10 CTL 00 09 01 00 - 00 00 00 00 SET CONFIG 19us 24.1.0 10 CTL 21 0a 00 00 - 00 00 00 00 CLASS 20ms 25.1.0 10 CTL 80 06 00 22 - 00 00 81 00 GET DESCRIPTR 2.5ms 26.1.0 10 DI 05 01 09 06 - a1 01 05 07 - 19 e0 29 e7 - 15 00 25 01 ..........)...%. 12ms 26.2.0 75 01 95 08 - 81 02 95 01 - 75 08 81 01 - 95 03 75 01 u.......u.....u. 26.2.16 05 08 19 01 - 29 03 91 02 - 95 05 75 01 - 91 01 95 06 ....).....u..... 26.2.32 75 08 15 00 - 26 ff 00 05 - 07 19 00 2a - ff 00 81 00 u...&......*.... 26.2.48 c0 . 26.2.64 10 CTL 21 09 00 02 - 00 00 01 00 CLASS 1.0sc 27.1.0 10 DO 01 . 3.4ms 27.2.0


第一個(gè)為不行的,取了兩次設(shè)備符, 18 CTL 80 06 00 01 - 00 00 12 00 GET DESCRIPTR 853ms 6.1.0 18 DI 12 01 10 01 - 00 00 00 08 - 2c 1a 21 0c - 10 01 01 02 ........,.!..... 5.9ms 6.2.0 00 01

19 CTL 80 06 00 01 - 00 00 12 00 GET DESCRIPTR 1.6ms 19.1.0 19 DO 12 01 10 01 - 00 00 00 08 - 2c 1a 21 0c - 10 01 01 02 ........,.!..... 3us 19.2.0 00 01

第二個(gè)為OK的,只取了一次 10 CTL 80 06 00 01 - 00 00 12 00 GET DESCRIPTR 3.1ms 21.1.0 10 DI 12 01 10 01 - 00 00 00 08 - 3c 41 06 21 - 01 01 01 02 ........ 00 01


看了你第一個(gè)鍵盤獲取的描述符,第二次獲取的時(shí)候數(shù)據(jù)方向D0(Data Out)這是不對(duì)的,你的設(shè)備接到電腦上能用嗎?還有你二樓說的 就這個(gè)不行(用的芯片不同)是什么意思?


接到電腦上可以用,沒有問題 還有你二樓說的 就這個(gè)不行(用的芯片不同)是什么意思?-------------兩個(gè)鍵盤用的芯片不同,其他的芯片沒有問題,只有這個(gè)VID不同的芯片不能取得描述符。


你把你的程序打包發(fā)送到我的郵箱。


只有登錄才能回復(fù),可以選擇微信賬號(hào)登錄

国产91精品新入口,国产成人综合网在线播放,九热这里只有精品,本道在线观看,美女视频a美女视频,韩国美女激情视频,日本美女pvp视频