How do I access a USB serial port without an entry in /dev?

31,478

You could try making the device node manually. On my system /dev/ttyUSB0 is major 188 and minor 0. And hopefully, my supposition is correct that it's a type c meaning character device (maybe try u for unbuffered character device if c doesn't work).

mknod /dev/ttyUSB0 c 188 0

If this worked, and the device file was appearing automatically before, something in your udev is messed up. There could also be an issue with USB subsystem settings or drivers.

Share:
31,478

Related videos on Youtube

Steven T. Snyder
Author by

Steven T. Snyder

I have quite a collection of hats, and wear most of them professionally on a daily basis. Software engineer, electrical engineer, systems administrator, graphic designer, scientist, product designer, and more. I work for a think tank / R&D company in Southern California.

Updated on September 18, 2022

Comments

  • Steven T. Snyder
    Steven T. Snyder over 1 year

    I have a USB to serial adapter based on the SiLabs CP2101 chipset. I'm trying to use it with Debian 5.0 Lenny (armel architecture).

    I seem to be able to get the proper kernel module to recognize the adapter, but it won't create /dev/ttyUSB0.

    I ran modprobe usbserial and modprobe cp2101 and then connected the device, resulting in the following output from dmesg:

    usb 2-1: new full speed USB device using mv5182_ehci and address 8
    usb 2-1: configuration #1 chosen from 1 choice
    cp2101 2-1:1.0: cp2101 converter detected
    usb 2-1: reset full speed USB device using mv5182_ehci and address 8
    usb 2-1: cp2101 converter now attached to ttyUSB0
    

    However, /dev/ttyUSB0 does not exist. There are no new files in /dev.

    find / -type f -name ttyUSB0 gives no results.

    I did find a bunch of directories named ttyUSB0 that showed up after plugging in the device:

    /sys/class/tty/ttyUSB0
    /sys/bus/usb-serial/drivers/cp2101/ttyUSB0
    /sys/bus/usb-serial/devices/ttyUSB0
    /sys/devices/platform/mv5182_ehci.1/usb2/2-1/2-1:1.0/ttyUSB0
     ...
    

    I found a file at /sys/bus/usb-serial/devices/ttyUSB0/ttyUSB0/dev but it does not appear to be a serial port; I can't open it with screen or Python's serial module.

    To compare, I tried my Debian 6.0 development machine (which has a newer version of the cp2101 module now called cp210x) and after seeing the "converter now attached to ttyUSB0" line in dmesg, /dev/ttyUSB0 appears.

    How do I get the cp2101 module to create /dev/ttyUSB0? If I can't, what file do I open to access the serial port?

  • Steven T. Snyder
    Steven T. Snyder almost 12 years
    This worked. Thanks! I still need to figure out how to get it do this automatically, but at least I can continue with testing.
  • Steven T. Snyder
    Steven T. Snyder almost 12 years
    BTW, this is a fresh Debian 5.0 image on an embedded system. It could just be that the kernel modules (or settings) that came with Debian 5.0 don't work right. Where can I look for settings that might be relevant?