linux - Linux 上的串行通信连接

标签 linux serial-port usb putty archlinux

我有一个RedBee RFID Reader 。它的用户文档仅适用于Windows,而我使用的是ArchLinux。我唯一一次通过 USB 端口进行串行通信是 Arduino那是通过他们的 GUI 环境,所以我从未接触过金属。我有一个 RFID 读取器,您可以通过 USB 端口进行串行通信。波特率为9600 ,设备连接到/dev/bus/usb/004/004ls -l /dev/bus/usb/004/004的输出是:

crwxrwxrwx 1 root root 189, 387 Mar  8 19:14 /dev/bus/usb/004/004

lsusb 的输出是

Bus 004 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-
Serial (UART) IC
Bus 004 Device 003: ID 0cf3:3005 Atheros Communications, Inc. AR3011 Bluetooth
...

lsusb -s 004:004 -v的输出是:

Bus 004 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x0403 Future Technology Devices International, Ltd
  idProduct          0x6001 FT232 USB-Serial (UART) IC
  bcdDevice            6.00
  iManufacturer           1 FTDI
  iProduct                2 FT232R USB UART
  iSerial                 3 A900DGX9
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           32
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower               90mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              2 FT232R USB UART
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        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     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)

这是 dmsg | grep -i tty 的输出

[    0.000000] console [tty0] enabled
[    7.226118] systemd[1]: Starting system-getty.slice.
[    7.226397] systemd[1]: Created slice system-getty.slice.
[   10.535204] usb 4-1.7: FTDI USB Serial Device converter now attached to ttyUSB0
[ 6372.435916] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[ 7961.660760] usb 4-1.7: FTDI USB Serial Device converter now attached to ttyUSB0
[ 7964.716225] ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
[ 8282.582961] usb 4-1.7: FTDI USB Serial Device converter now attached to ttyUSB0

我尝试过的事情:

  • 我尝试使用 putty 的(为 Linux 编译的)串行选项连接到/dev/bus/usb/004/004 但它响应:

    Unable to open connection to:
    Unable to configure serial port
    

最佳答案

解决方案是使用dmesg | grep -i tty 获取设备已连接的 TTY。就我而言,我需要连接到 /dev/ttyUSB0 而不是 /dev/bus/usb/004/004

更多信息

dmesg

关于linux - Linux 上的串行通信连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22277441/

相关文章:

c - 使用 getline 当行为空时退出循环

windows - linux下如何处理CP-1252编码的密码?

c# - 串行端口。 BytesToRead() 函数

serial-port - RS232 上的 DTR/RTS 可以用作 GPIO 来打开/关闭传感器吗?协议(protocol)允许这种配置吗?

linux - 在 bash 中使用命名管道 - 数据丢失问题

serial-port - 115,200 或更高的实际波特率是否可能?

android - 如何使用JNA调用C的_IOR宏?

c++ - USB 射频接收器鼠标黑客攻击

serial-port - 在 Windows 2000 上使用 USB 下载的 Arduino 编程失败

linux - 使用 Linux/Vim 将头文件或文本文件信息转换为代码