原版的能夠正常枚舉,添加串口監(jiān)控后不能枚舉,請高手解答 這是工程[b]文字[/b] UploadImages/201421816261398.rar 監(jiān)控的數(shù)據(jù)包 Device Length Phase Data Description ------ -------- ----- -------------------------------------------------- ---------------- 10.1 2 IN 04 00 .. 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 10.0 4 IN 01 01 01 00 .... 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL 23 01 10 00 02 00 00 00 CLEAR FEATURE 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 10.0 4 IN 01 01 00 00 .... 8.2 32 IN 00 e0 e0 e0 00 e0 e0 e0 e0 00 e0 00 00 e0 00 e0 ................ 00 e0 e0 e0 00 e0 00 00 e0 e0 00 e0 00 e0 e0 e0 ................ 8.2 31 IN e0 e0 00 00 e0 00 00 e0 00 e0 e0 e0 00 e0 00 00 ................ 00 e0 e0 e0 00 00 e0 e0 e0 e0 e0 e0 e0 00 e0 ............... 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL 23 03 04 00 02 00 00 00 SET FEATURE 10.1 2 IN 04 00 .. 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 10.0 4 IN 03 01 10 00 .... 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL 23 01 14 00 02 00 00 00 CLEAR FEATURE 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 10.0 4 IN 03 01 00 00 .... 8.2 3 IN e0 00 e0 ... 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL 23 03 04 00 02 00 00 00 SET FEATURE 10.1 2 IN 04 00 .. 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 10.0 4 IN 03 01 10 00 .... 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL 23 01 14 00 02 00 00 00 CLEAR FEATURE 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 10.0 4 IN 03 01 00 00 .... 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL 23 03 04 00 02 00 00 00 SET FEATURE 10.1 2 IN 04 00 .. 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 10.0 4 IN 03 01 10 00 .... 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL 23 01 14 00 02 00 00 00 CLEAR FEATURE 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 10.0 4 IN 03 01 00 00 .... 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL 23 03 04 00 02 00 00 00 SET FEATURE 10.1 2 IN 04 00 .. 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 10.0 4 IN 03 01 10 00 .... 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL 23 01 14 00 02 00 00 00 CLEAR FEATURE 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 10.0 4 IN 03 01 00 00 .... 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL 23 01 01 00 02 00 00 00 CLEAR FEATURE 8.0 CTL a3 00 00 00 01 00 04 00 CLASS 8.0 4 IN 03 05 00 00 .... 10.0 CTL a3 00 00 00 01 00 04 00 GET STATUS 10.0 4 IN 03 01 00 00 .... 8.0 CTL 40 a1 9c c3 8b cc 00 00 VENDOR 8.0 CTL 40 9a 2c 0f 07 00 00 00 VENDOR 8.0 CTL 40 a4 df 00 00 00 00 00 VENDOR 8.0 CTL 40 a4 9f 00 00 00 00 00 VENDOR 8.0 CTL c0 95 06 07 00 00 02 00 VENDOR
添加串口信息不影響程序的正常使用,你的打印信息是什么?有沒有進(jìn)入外部中斷?最好是串口使用查詢方式。
從你的USB數(shù)據(jù)包來看,獲取設(shè)備描述符的命令都沒發(fā)下來。
else if(!((c1=request.r.bmRequestType)&0x60)){ //標(biāo)準(zhǔn)請求 這段代碼有疑問這樣怎么判斷出是標(biāo)準(zhǔn)請求?? 整個工程我都打包發(fā)上來了,能幫忙看看嗎?沒有用進(jìn)入外部中斷,監(jiān)控顯示只有初始化正確
標(biāo)準(zhǔn)請求的話bmRequestType的D6、D5位為0(詳細(xì)可以看一下USB規(guī)范),結(jié)合程序除了0x20和0x60外都是標(biāo)準(zhǔn)請求。 建議你串口使用查詢方式,保證能正確進(jìn)入外部中斷。
能不能解釋下串口為什么不能用中斷方式,如果這樣別的中斷能不能用,奇怪的問題………………
只要設(shè)置好中斷優(yōu)先級應(yīng)該是可以使用的,因為你不斷地在打印不建議你這么做。