简体   繁体   English

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

[英]How to access USB barcode scanner data directly from USB port using C/C++ without driver

Currently I am working on USB port programming for Linux to fully control USB ports. 目前,我正在为Linux进行USB端口编程,以完全控制USB端口。 I am running Ubuntu 13.04 and am trying to read data from ttySX files for USB port and also from /dev/bus/usb. 我正在运行Ubuntu 13.04,并尝试从ttySX文件读取USB端口以及/ dev / bus / usb的数据。 But I am not getting any results. 但是我没有任何结果。

I searched and found ttyUSBX port, but in my case there is no tty. 我搜索并找到ttyUSBX端口,但就我而言,没有tty。 Also, the problem is that the manufacturer of my USB barcode scanner does not provide a driver for linux. 另外,问题是我的USB条码扫描器的制造商未提供Linux驱动程序。 So can any one suggest me how to read data from USB port without a driver? 那么有人可以建议我如何在没有驱动程序的情况下从USB端口读取数据吗?

Most barcode scanners can work as simple usb-to-serial converters and thus you get a ttyusbx device in /dev. 大多数条形码扫描仪可以用作简单的USB到串行转换器,因此您可以在/ dev中获得ttyusbx设备。 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. 通常的工作方式是从制造商的网站上下载某些软件或手册,然后扫描条形码或一系列条形码以使设备处于此模式。

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? 您有机会提供扫描仪的品牌和型号吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM