从 USB 条码扫描仪读取
我有这个漂亮的 USB 条形码扫描仪,我想使用 USB 驱动程序而不是键盘输入来读取输入。
如何使用 .NET 来实现这一点?有现成的库吗?我找不到任何真正有用的东西......
谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果它是 USB 读卡器,您应该找到它附带的 .net 驱动程序,这样您就可以获得一个提供 IO 以及可能更多功能的类。
如果扫描仪内部有一个 USB 转串行转换器,那么您应该在设备管理器中看到扫描仪正在使用哪个 COM 端口。在这种情况下,您可以使用
SerialPort
类与设备进行通信。请注意,在进行任何通信之前,您应该正确设置设置(即波特率、奇偶校验位、停止位等)。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.您可以使用 USB HID 报告读取(和控制)设备。
http://www.codeproject.com/KB/cs/USB_HID.aspx
http://www.弗洛里安-莱特纳.de/index.php/2007/08/03/hid-usb-driver-library/
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/