如何在没有驱动的情况下使用C/ c++直接从USB端口访问USB条形码扫描器数据

时间:2022-05-10 21:52:07

Currently I am working on USB port programming for Linux to fully control USB ports. I am running Ubuntu 13.04 and am trying to read data from ttySX files for USB port and also from /dev/bus/usb. But I am not getting any results.

目前我正在为Linux的USB接口编程工作,以完全控制USB端口。我正在运行Ubuntu 13.04,并且正在尝试从ttySX文件中读取USB端口和/dev/bus/usb的数据。但是我没有得到任何结果。

I searched and found ttyUSBX port, but in my case there is no tty. Also, the problem is that the manufacturer of my USB barcode scanner does not provide a driver for linux. So can any one suggest me how to read data from USB port without a driver?

我搜索并找到了ttyUSBX端口,但在我的情况下没有tty。另外,问题是我的USB条形码扫描器的制造商没有为linux提供驱动程序。有谁能告诉我如何在没有驱动的情况下从USB端口读取数据吗?

1 个解决方案

#1


3  

Most barcode scanners can work as simple usb-to-serial converters and thus you get a ttyusbx device in /dev. The way this usually works is you download some software or manual from the manufacturer's website and scan a barcode or a series of barcodes that put the device in this mode.

大多数条码扫描器可以作为简单的usb-to-串行转换器工作,因此您可以在/dev中获得ttyusbx设备。通常情况下,你可以从制造商的网站上下载一些软件或手册,然后扫描条码或一系列条码,使设备处于这种模式。

Even simpler, ALL barcode scanners should work as HID devices(keyboard)...again this requires downloading some sort of software or manual and scanning a couple barcodes.

更简单的是,所有条码扫描器都应该像HID设备(键盘)一样工作……这需要下载一些软件或手册,扫描一些条形码。

Any chance you could provide the scanner's make and model?

你能提供扫描仪的制造和模型吗?

#1


3  

Most barcode scanners can work as simple usb-to-serial converters and thus you get a ttyusbx device in /dev. The way this usually works is you download some software or manual from the manufacturer's website and scan a barcode or a series of barcodes that put the device in this mode.

大多数条码扫描器可以作为简单的usb-to-串行转换器工作,因此您可以在/dev中获得ttyusbx设备。通常情况下,你可以从制造商的网站上下载一些软件或手册,然后扫描条码或一系列条码,使设备处于这种模式。

Even simpler, ALL barcode scanners should work as HID devices(keyboard)...again this requires downloading some sort of software or manual and scanning a couple barcodes.

更简单的是,所有条码扫描器都应该像HID设备(键盘)一样工作……这需要下载一些软件或手册,扫描一些条形码。

Any chance you could provide the scanner's make and model?

你能提供扫描仪的制造和模型吗?