怎樣檢測USB打印機無紙

用C語言 基于三星2410 ARM920 usb芯片是SL811 打印機是hp1150或1160(PCL5e命令) 也可以用hp1020(ACL命令)(不建議)

要求用C編寫一個模塊(函數(shù))來判斷 USB打印機有沒有紙,從而給出相應(yīng)的提示信息

我還要提供一些相關(guān)的資料支持! 可速聯(lián)系本人(有報酬) e_mail : 個人信息保護(hù),已隱藏

只要發(fā)送獲取端口狀態(tài)的命令就可以獲取到了,命令碼如下: buffer[0]=0xA1;buffer[1]=1;buffer[2]=buffer[3]=buffer[4]=buffer[5]=0;buffer[6]=1;buffer[7]=0; /* SETUP數(shù)據(jù),GET_PORT_STATUS */ 如果沒有紙的話,那么位5的數(shù)據(jù)應(yīng)該為1


先謝謝hcn~ 就知道你會回答~ 其實這個我是知道的! 但無論有紙還是沒紙每次獲取返回的值都是0x18 即:00011000 第五位總是0 即總是有紙~~ 不知道是不是打印機的問題 hp1150/1160都不行


那你將打印機直接接到計算機上面也是這樣返回的嗎?


是指用bushound發(fā)命令給打印機嗎?

還是其他方法? 怎么發(fā)?


不是的,你只要將打印機的紙取走之后,過一段時間主機就會發(fā)送獲取端口狀態(tài)的命令,這時候你可以用BUSHOUND來抓.


哦 ? 是嗎? 我抓來看看有沒有~


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

1

Device - Device ID (followed by the endpoint for USB devices) (5) Intel(R) 82801FB/FBM USB Universal Host Controller - 2658 (6) USB Root Hub (19) hp LaserJet 1150 (DOT4) (20) IEEE 1284.4 兼容打印機 (21) hp LaserJet 1150 PCL 5e Phase - Phase Type CTL USB control transfer DI Data in LEN Data length Data - Hex dump of the data transferred Descr - Description of the phase Delta - Elapsed time from the previous phase to the current phase Time - Time the phase occurred in hour:minute:second.millisec form

Device Phase Data Description Delta Time ------ ----- ------------------------------------------------------------------------------------------------------ ---------------- ----- ------------ 6.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 5.3sc 01:35:39.446 6.0 LEN 04 00 00 00 4 27us 01:35:39.446 6.0 DI 01 01 01 00 .... 2us 01:35:39.446 6.0 CTL 23 01 10 00 02 00 00 00 CLEAR FEATURE 71us 01:35:39.446 6.0 CTL a3 00 00 00 01 00 04 00 GET STATUS 74us 01:35:39.446 6.0 LEN 04 00 00 00 4 21us 01:35:39.446 6.0 DI 00 01 00 00 .... 3us 01:35:39.446 6.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 17us 01:35:39.446 6.0 LEN 04 00 00 00 4 19us 01:35:39.446 6.0 DI 01 01 00 00 .... 3us 01:35:39.446 6.0 CTL 23 03 04 00 02 00 00 00 SET FEATURE 124ms 01:35:39.571 6.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 31ms 01:35:39.602 6.0 LEN 04 00 00 00 4 33us 01:35:39.602 6.0 DI 03 01 10 00 .... 3us 01:35:39.602 6.0 CTL 23 01 14 00 02 00 00 00 CLEAR FEATURE 7us 01:35:39.602 6.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 31ms 01:35:39.634 6.0 LEN 04 00 00 00 4 42us 01:35:39.634 6.0 DI 03 01 00 00 .... 3us 01:35:39.634 6.0 CTL 23 03 04 00 02 00 00 00 SET FEATURE 35ms 01:35:39.669 6.0 CTL a3 00 00 00 02 00 04 00 GET STATUS 27ms 01:35:39.696 6.0 LEN 04 00 00 00 4 34us 01:35:39.696 6.0 DI 03 01 10 00 .... 2us 01:35:39.696 6.0 CTL 23 01 14 00 02 00 00 00 CLEAR FEATURE 7us 01:35:39.696 6.0 CTL 80 06 00 03 00 00 ff 00 GET DESCRIPTOR 103ms 01:35:39.800 6.0 LEN 04 00 00 00 4 4.9ms 01:35:39.805 6.0 DI 04 03 09 04 .... 3us 01:35:39.805 6.0 CTL 80 06 03 03 09 04 ff 00 GET DESCRIPTOR 25us 01:35:39.805 6.0 LEN 1a 00 00 00 26 7.9ms 01:35:39.813 6.0 DI 1a 03 30 00 30 00 43 00 4e 00 43 00 43 00 30 00 30 00 39 00 35 00 37 00 34 00 ..0.0.C.N.C.C.0. 5us 01:35:39.813 6.0 CTL 80 06 00 02 00 00 ff 00 GET DESCRIPTOR 38us 01:35:39.813 6.0 LEN 4e 00 00 00 78 13ms 01:35:39.827 6.0 DI 09 02 4e 00 01 01 00 c0 01 09 04 00 00 03 07 01 03 00 07 05 01 02 40 00 00 07 05 81 02 40 00 00 ..N............. 4us 01:35:39.827 07 05 82 03 08 00 ff 09 04 00 01 02 07 01 02 00 07 05 01 02 40 00 00 07 05 81 02 40 00 00 09 04 ................ 00 02 01 07 01 01 00 07 05 01 02 40 00 00 ...........@.. 19.0 CTL 80 06 00 01 00 00 12 00 GET DESCRIPTOR 51ms 01:35:39.879 19.0 LEN 12 00 00 00 18 5.1ms 01:35:39.884 19.0 DI 12 01 10 01 00 00 00 08 f0 03 17 0f 00 01 01 02 03 01 ................ 4us 01:35:39.884 19.0 CTL 80 06 00 02 00 00 09 01 GET DESCRIPTOR 26us 01:35:39.884 19.0 LEN 4e 00 00 00 78 13ms 01:35:39.898 19.0 DI 09 02 4e 00 01 01 00 c0 01 09 04 00 00 03 07 01 03 00 07 05 01 02 40 00 00 07 05 81 02 40 00 00 ..N............. 5us 01:35:39.898 07 05 82 03 08 00 ff 09 04 00 01 02 07 01 02 00 07 05 01 02 40 00 00 07 05 81 02 40 00 00 09 04 ................ 00 02 01 07 01 01 00 07 05 01 02 40 00 00 ...........@.. 19.0 CTL 00 09 01 00 00 00 00 00 SET CONFIG 26us 01:35:39.898 19.0 CTL a1 00 00 00 00 00 ff 00


我是沒裝紙 就把打印機連到電腦上 上面是用busbound抓的


獲取狀態(tài)的命令還沒有出來,主機應(yīng)該會發(fā)我上面說的命令碼,這種狀態(tài)要過一段時間主機才會發(fā)


請問下 現(xiàn)在開發(fā)usb打印機(PCL5e)驅(qū)動一般采用哪一款打印機啊? 越便宜越好!


我是等了很久的 ~沒發(fā)現(xiàn)有其他的命令啊~~


召喚hcn~~~~ 你用Get_Port_Status來獲取打印機狀態(tài) 所使用的打印機是什么牌子型號的啊?? 能支持PCL命令嗎? 謝謝~~


我用的是三星的打印機,具體型號記不清了,在獲取端口狀態(tài)的時候要很長時間,可能要幾分鐘才返回,你就將你的計算機一直處在打印狀態(tài)的話應(yīng)該就會出這個現(xiàn)象的


要幾分鐘啊? 打印個東西要檢測這么久那樣不合理了~ 哎~~ 還是考慮其他方案算了~


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

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