无法连接到USB串行端口(GSM调制解调器)

问题描述:

我决定为我的Linux机器启动一个GSM调制解调器(Vmware上的OpenSuse 12.1 64位),以便我可以将它用作SMS网关。我有一个Wavecom M1306B GSM调制解调器,它提供了一个USB接口,显然有一个USB电缆(端到端,GSM调制解调器到我的桌面)。无法连接到USB串行端口(GSM调制解调器)

我通过在Windows 7 64位PC上运行一些基本命令,成功测试了该调制解调器。 (如:AT,ATZ,..)

这里有一些我的日志:

machine2:~ # lsusb 
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub 
Bus 001 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse 
Bus 001 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub 
Bus 001 Device 006: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port 

-v的lsusb输出该接口:

Bus 001 Device 006: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port 
Device Descriptor: 
    bLength    18 
    bDescriptorType   1 
    bcdUSB    1.10 
    bDeviceClass   0 (Defined at Interface level) 
    bDeviceSubClass   0 
    bDeviceProtocol   0 
    bMaxPacketSize0  64 
    idVendor   0x067b Prolific Technology, Inc. 
    idProduct   0x2303 PL2303 Serial Port 
    bcdDevice   3.00 
    iManufacturer   1 Prolific Technology Inc. 
    iProduct    2 USB-Serial Controller 
    iSerial     0 
    bNumConfigurations  1 
    Configuration Descriptor: 
    bLength     9 
    bDescriptorType   2 
    wTotalLength   39 
    bNumInterfaces   1 
    bConfigurationValue  1 
    iConfiguration   0 
    bmAttributes   0xa0 
     (Bus Powered) 
     Remote Wakeup 
    MaxPower    100mA 
    Interface Descriptor: 
     bLength     9 
     bDescriptorType   4 
     bInterfaceNumber  0 
     bAlternateSetting  0 
     bNumEndpoints   3 
     bInterfaceClass  255 Vendor Specific Class 
     bInterfaceSubClass  0 
     bInterfaceProtocol  0 
     iInterface    0 
     Endpoint Descriptor: 
     bLength     7 
     bDescriptorType   5 
     bEndpointAddress  0x81 EP 1 IN 
     bmAttributes   3 
      Transfer Type   Interrupt 
      Synch Type    None 
      Usage Type    Data 
     wMaxPacketSize  0x000a 1x 10 bytes 
     bInterval    1 
     Endpoint Descriptor: 
     bLength     7 
     bDescriptorType   5 
     bEndpointAddress  0x02 EP 2 OUT 
     bmAttributes   2 
      Transfer Type   Bulk 
      Synch Type    None 
      Usage Type    Data 
     wMaxPacketSize  0x0040 1x 64 bytes 
     bInterval    0 
     Endpoint Descriptor: 
     bLength     7 
     bDescriptorType   5 
     bEndpointAddress  0x83 EP 3 IN 
     bmAttributes   2 
      Transfer Type   Bulk 
      Synch Type    None 
      Usage Type    Data 
     wMaxPacketSize  0x0040 1x 64 bytes 
     bInterval    0 
Device Status:  0x0000 
    (Bus Powered) 



machine2:/proC# setserial -a /dev/ttyUSB0 
/dev/ttyUSB0, Line 0, UART: 16654, Port: 0x0000, IRQ: 0 
     Baud_base: 460800, close_delay: 0, divisor: 0 
     closing_wait: infinte 
     Flags: spd_normal 

machine2:/home/smsto/bin # setserial -a /dev/ttyS0 
/dev/ttyS0, Line 0, UART: 16550A, Port: 0x03f8, IRQ: 4 
     Baud_base: 115200, close_delay: 50, divisor: 0 
     closing_wait: 3000 
     Flags: spd_normal skip_test 

machine2:/home/smsto/bin # setserial -a /dev/ttyS1 
/dev/ttyS1, Line 1, UART: 16550A, Port: 0x02f8, IRQ: 3 
     Baud_base: 115200, close_delay: 50, divisor: 0 
     closing_wait: 3000 
     Flags: spd_normal skip_test 

machine2:/proC# setserial -G /dev/ttyUSB0 
/dev/ttyUSB0 uart 16654 port 0x0000 irq 0 baud_base 460800 spd_normal 

machine2:/proC# setserial /dev/ttyUSB0 
/dev/ttyUSB0, UART: 16654, Port: 0x0000, IRQ: 0 


machine2:/proc/tty/driver # ls -ltr 
total 0 
-r--r--r-- 1 root root 0 Jan 10 14:03 usbserial 
-r--r--r-- 1 root root 0 Jan 10 14:03 serial 

machine2:/proc/tty/driver # cat serial 
serinfo:1.0 driver revision: 
0: uart:16550A port:000003F8 irq:4 tx:0 rx:0 CTS|DSR|CD 
1: uart:16550A port:000002F8 irq:3 tx:0 rx:0 CTS|DSR|CD 
2: uart:unknown port:000003E8 irq:4 
3: uart:unknown port:000002E8 irq:3 
4: uart:unknown port:00000000 irq:0 
5: uart:unknown port:00000000 irq:0 
6: uart:unknown port:00000000 irq:0 
7: uart:unknown port:00000000 irq:0 

machine2:/proc/tty/driver # cat usbserial 
usbserinfo:1.0 driver:2.0 
0: module:pl2303 name:"pl2303" vendor:067b product:2303 num_ports:1 port:1 path:usb-0000:02:00.0-2.1 

machine2:/proc/tty # cat drivers 
/dev/tty    /dev/tty  5  0 system:/dev/tty 
/dev/console   /dev/console 5  1 system:console 
/dev/ptmx   /dev/ptmx  5  2 system 
/dev/vc/0   /dev/vc/0  4  0 system:vtmaster 
usbserial   /dev/ttyUSB 188 0-253 serial 
serial    /dev/ttyS  4 64-79 serial 
pty_slave   /dev/pts  136 0-1048575 pty:slave 
pty_master   /dev/ptm  128 0-1048575 pty:master 
unknown    /dev/tty  4 1-63 console 


machine2:/proc/tty # dmesg | grep -i tty 

[ 1.383652] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A 
[ 1.424541] serial8250: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A 
[ 1.581063] 00:0a: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A 
[ 1.654207] 00:0b: ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A 
[ 1.938507] tty tty17: hash matches 
[ 2498.137304] usb 1-2.1: pl2303 converter now attached to ttyUSB0 

我注意到的波特率USB0接口太多了,所以我试图指定115200:

machine2:/proC# setserial /dev/ttyUSB0 baud_base 115200 
Cannot set serial info: Invalid argument 

所以,这是问题......并且我收到此错误。 每当我尝试通过minicom连接S0,S1,USB0接口时,它都不起作用。

Baud_base不是端口速度,它是分频比为1时的最大速度。设置baud_base的能力可能根本不适用于USB串行设备,它绝对不是什么你要。

使用stty来设置端口速度,或使用cuminicom进行测试(它们可以自行设置端口速度)。

+0

感谢您的提示,我试过stty -F/dev/ttyUSB0 115200,结果仍然相同。在minicom中,在打字命令期间,我只看到奇怪的ascii字符。 – atari83

+0

您是否收到相同或不同回复的相同命令(例如只有AT应该给予OK)以不同的速度? (我会从9600开始)?设备是否有可能根本不支持AT命令,而使用一些专有的二进制协议呢? –

+0

谢谢安东,它的工作原理!现在我成功地运行在57600(波特率)上的设备。现在我看到了我的AT命令和响应,但是我只是遇到了另一个问题,当我尝试发送一条短信时,我收到来自设备的“+ CMS ERROR:512”。我可以向你展示我使用过的命令的完整列表,但它非常直接,从我的Windows PC,我看到了相同的结果。是因为设备坏了吗? – atari83

我不知道的波特率,但如果你打开另一终端和第一终端做cat /dev/ttyUSB0 然后做echo AT > /dev/ttyUSB0你可能会得到一个确定back..not知道,如果它可以帮助,但它应该让你一个响应至少......

+0

感谢您的回复,结果很奇怪。而不是确定,我收到奇怪的ascii:...Jø – atari83