无法连接到usb串口(GSM调制解调器)

时间:2013-01-10 16:40:25

标签: linux serial-port gsm modem usbserial

我决定为我的Linux机器(Vmware上的OpenSuse 12.1 64位)启用GSM调制解调器,以便我可以将它用作SMS网关。我有一个Wavecom M1306B GSM调制解调器,提供USB接口,显然有一条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

该界面的lsusb -v输出:

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接口时,它根本不起作用。

2 个答案:

答案 0 :(得分:1)

Baud_base不是端口速度,它是分频器为1时的最大速度。设置baud_base的能力可能根本不适用于USB串行设备,而且肯定不是你想要的。

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

答案 1 :(得分:0)

我不确定波特率但是如果你打开另一个终端并执行cat /dev/ttyUSB0 然后在第一个终端做echo AT > /dev/ttyUSB0你可能会得到一个好的回来......不确定它是否有帮助,但它应该至少得到你的响应..