Reading from an USB barcode scanner

血红的双手。 提交于 2019-12-17 23:14:45

问题


I've got this nice USB barcode scanner and I'd like to readthe input using the USB driver and not the keyboard input.

How can this be accomplished using .NET? any ready libraries? I couldn't find anything of real use...

Thanks!


回答1:


If it is a USB reader, you should find the .net drivers that come with it, such that you get a class which provides the IO and perhaps more functionality.

If the scanner has internally a USB to Serial converter, then you should see in your Device Manager which COM port is in use by the scanner. In that case, you can use the SerialPort class for communication to the device. Note that you should set the settings (i.e. baudrate, parity bit, stop bit, etc) correct before you can have any communication.




回答2:


You can read (and control) the device using USB HID reports.

http://www.codeproject.com/KB/cs/USB_HID.aspx

http://www.florian-leitner.de/index.php/2007/08/03/hid-usb-driver-library/



来源:https://stackoverflow.com/questions/3001543/reading-from-an-usb-barcode-scanner

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!