USB串行通信无法在Linux上运行(Bill Validator GBA ST2)

时间:2017-04-06 16:31:06

标签: linux usb usbserial

我正在尝试使用USB串行连接与GBA ST2 Bill Validator通信。在Windows上一切正常(设备随后连接到COM端口)但在Linux上没有(到目前为止使用Ubuntu 14.04,16.04和Debian 8)。

默认使用 cdc_acm 驱动程序,它附加到/ dev / ttyACMx,但它不响应任何请求。 (但是在睡眠模式下请求时它会立即唤醒)。

dmesg lsusb 的相关输出:

$ dmesg
[26600.821389] usb 2-1: new full-speed USB device number 37 using ohci-pci
[26601.307233] usb 2-1: New USB device found, idVendor=16f9, idProduct=0003
[26601.307237] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[26601.307239] usb 2-1: Product: GBA ST2
[26601.307240] usb 2-1: Manufacturer: Astrosystems
[26601.307242] usb 2-1: SerialNumber: 06010010001
[26601.316173] cdc_acm 2-1:1.0: ttyACM0: USB ACM device

$ lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/12p, 12M
    |__ Port 1: Dev 37, If 0, Class=Communications, Driver=cdc_acm, 12M
    |__ Port 1: Dev 37, If 1, Class=CDC Data, Driver=cdc_acm, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/12p, 480M

当强制设备使用 usbserial 驱动程序时,我能够在Linux VM(Windows上托管的Virtualbox)下使用它,但不能在普通的Linux机器上使用它。我使用以下命令来使用usbserial驱动程序:

sudo modprobe -r cdc_acm
sudo modprobe usbserial vendor=0x16f9 product=0x0003

相关 dmesg lsusb 输出:

$ sudo dmesg
[26022.203166] usbserial: USB Serial support registered for generic
[26022.203188] usbserial_generic 2-1:1.0: Generic device with no bulk out, not allowed.
[26022.206497] usbserial_generic: probe of 2-1:1.0 failed with error -5
[26022.206530] usbserial_generic 2-1:1.1: The "generic" usb-serial driver is only for testing and one-off prototypes.
[26022.206532] usbserial_generic 2-1:1.1: Tell linux-usb@vger.kernel.org to add your device to a proper driver.
[26022.206533] usbserial_generic 2-1:1.1: generic converter detected
[26022.207075] usb 2-1: generic converter now attached to ttyUSB0

 lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/12p, 12M
    |__ Port 1: Dev 35, If 0, Class=Communications, Driver=, 12M
    |__ Port 1: Dev 35, If 1, Class=CDC Data, Driver=usbserial_generic, 12M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/12p, 480M

如何在Linux下与此设备通信?任何想法都将不胜感激。

1 个答案:

答案 0 :(得分:0)

depends on what protocol the bill validator uses at the moment, according to http://www.intelligentvending.co.uk/payment-systems-telemetry/banknote-readers-note-stackers/gba-st2.htm it is able to communicate over ccTalk, MDB, Parallel, Pulse, Serial, SSP

you can communicate with a CDC ACM device using socat. an example for using socat to send AT commands is on https://unix.stackexchange.com/questions/97242/how-to-send-at-commands-to-a-modem-in-linux

socat establishes the connection what command sequences you have to send depends on the present protocol of the bill validator...