ewx: (geek)
[personal profile] ewx

I bought a PL2303-based USB serial adapter.


Linux

Linux has built-in drivers. I plugged it into my Debian stable box and /dev/ttyUSB0 appeared. I connected as follows:

picocom -f x -b 115200 /dev/ttyUSB0

Use ^A^X to quit. See "man picocom" for more information.


OS X

For OS X you have to download and install a driver. There are several choices:

  • http://www.prolific.com.tw/eng/downloads.asp?id=31
    • md-PL2303_MacOS10.6_dms_v1.4.0.zip
    • This is the vendor's driver
    • It supports USB vendor ID 067B, product ID 2303 (which is what I've got; you can use System Profiler to check).
    • The zipfile contains a DMG which contains an installer package, plus a readme.txt that tells you how to uninstall the kext.
    • It insists on a restart though I'm not sure why, as the device file appears without.

I went with the vendor driver. This makes the serial port appears as /dev/tty.usbserial:

$ ls -l /dev/tty.*
crw-rw-rw- 1 root wheel  11,  2 24 Sep 12:27 /dev/tty.Bluetooth-Modem
crw-rw-rw- 1 root wheel  11,  0 24 Sep 12:26 /dev/tty.Bluetooth-PDA-Sync
crw-rw-rw- 1 root wheel  11,  4 24 Sep 12:30 /dev/tty.usbserial

(When you plug it in, you will get a popup asking you if you want to set up a new network interface, Apple apparently believing that all serial devices are modems. Hit cancel.)

screen is a good way to access the serial port:

$ screen /dev/tty.usbserial 115200

Use ^A? to get help, or ^A^\ to quit. Send ^A^A if you just want a ^A. See "man screen" for more information.


Windows

Windows didn't have a driver when I plugged the device in the first time but it did manage to automatically find a link to something I could download and install. But it only came to life when I removed and reattached the adapter, at which point it announced it was COM7. (What happened to 1-6?)

PuTTY was able to connect.

(no subject)

Date: 2010-09-24 01:56 pm (UTC)
From: [identity profile] geekette8.livejournal.com
I thought that if the device enumerated with the correct device class and sub-class, OSX did not need any special drivers? (This was a problem for us with one device we had that was inadvertently announcing itself as a Bluetooth dongle, which meant OSX associated Bluetooth drivers with it and it all went horribly wrong).

(no subject)

Date: 2010-09-24 02:03 pm (UTC)
ext_8103: (Default)
From: [identity profile] ewx.livejournal.com
Well, it had no idea what it was until I installed the driver, so I guess that’s not the case…

(no subject)

Date: 2010-09-24 02:05 pm (UTC)
From: [identity profile] geekette8.livejournal.com
Or the device was not announcing its device class and sub-class correctly.

(no subject)

Date: 2010-09-24 02:15 pm (UTC)
ext_8103: (Default)
From: [identity profile] ewx.livejournal.com

I’d question why Apple feel the need to link to drivers if their OS supports it natively. Still, the question about what it enumerates as ought to be answerable, by someone who knows what to look for; this is what Linux makes of it:

[513699.120013] usb 1-2: new full speed USB device using uhci_hcd and address 3
[513699.359168] usb 1-2: configuration #1 chosen from 1 choice
[513699.369230] pl2303 1-2:1.0: pl2303 converter detected
[513699.409760] usb 1-2: pl2303 converter now attached to ttyUSB0
[513699.409921] usb 1-2: New USB device found, idVendor=067b, idProduct=2303
[513699.409925] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[513699.409927] usb 1-2: Product: USB-Serial Controller D
[513699.409930] usb 1-2: Manufacturer: Prolific Technology Inc. 




$ lsusb -vs001:003

Bus 001 Device 003: 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            4.00
  iManufacturer           1 Prolific Technology Inc. 
  iProduct                2 USB-Serial Controller D
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           39
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    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)

(no subject)

Date: 2010-09-24 02:26 pm (UTC)
From: [identity profile] geekette8.livejournal.com
Yep, it's defined itself as a vendor specific class (for reasons best known to itself):

bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0

bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass 0


The correct values for a CDC-compliant USB serial device are:

Class:
02h Communications Device Class

Sub-classes:
01h Direct Line Control Model
02h Abstract Control Model
03h Telephone Control Model
04h Multi-Channel Control Model
05h CAPI Control Model
06h Ethernet Networking Control Model
07h ATM Networking Control Model

(this is from http://www.usb.org/developers/devclass_docs/usbcdc11.pdf ).

(no subject)

Date: 2010-09-24 07:00 pm (UTC)
From: [identity profile] nmg.livejournal.com
Neat. I've been needing a device to do just this, and you've just done the legwork for me. Thanks!

(no subject)

Date: 2010-09-25 08:07 am (UTC)
pvaneynd: (Default)
From: [personal profile] pvaneynd
If I remember correctly from a while ago, that particular chipset has problems generating a 'break' in Linux.

Which makes the thing a bit useless for password recovery on Cisco devices...

(no subject)

Date: 2010-09-25 11:37 am (UTC)
cjwatson: (Default)
From: [personal profile] cjwatson
GRUB 1.99 (when it's released soon) should support these devices too, should you be that way inclined.

(no subject)

Date: 2010-09-25 01:12 pm (UTC)
ext_8103: (Default)
From: [identity profile] ewx.livejournal.com
Currently all my headless machines have a serial port anyway. Still, never know when that might come in handy.

November 2025

S M T W T F S
      1
2345678
91011121314 15
1617 181920 2122
23242526272829
30      

Most Popular Tags

Expand Cut Tags

No cut tags