random findings by wt8008
RSS icon Home icon
  • FTDI USB-Serial Converter for New Products

    Posted on April 14th, 2011 wt8008 No comments

    If you have a generic FTDI product that simulates a serial port (COM port), but it does not register as /dev/ttyUSB0 in Ubuntu/Linux, it could be that the device is too new or a rare product (industrial use) and not a recognized vendor/product ID. (This also applies for products that use a USB-Serial bridge for communications.) You can attempt to tell if the product uses such a chip by taking a look at the ICs on the product itself or by the drivers it uses in Windows.

    Use lsusb to see what new shows when you plugin the USB device.

    Bus 002 Device 002: ID 413c:a005 Dell Computer Corp. Internal 2.0 Hub

    In this example the vendor ID is 413c and the product ID is a005.

    You can manually allow it to register by:

    sudo modprobe ftdi_sio
    sudo su -c "echo 413c a005 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id"

    using the vendor and product IDs from the previous step. It should show up as /dev/ttyUSB0 unless you already have another device plugged in. You can see the output of dmesg to determine the exact name/device file.

    You may need to give yourself permissions to read and write to the device.

    sudo chmod +rw /dev/ttyUSB0

    Auto Register when Connected

    For automatically preforming the commands upon connection create a file /usr/local/bin/serial-usb.sh with contents

    #!/bin/bash
    modprobe ftdi_sio
    echo 413c a005 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id

    Give the file executable permissions with

    sudo chmod +x /usr/local/bin/serial-usb.sh

    Create a new udev rule to detect when the device is plugged in to run the previous script with a file in /etc/udev/rules.d/70-serial-usb.rules with the contents:

    ATTRS{idVendor}=="413c", ATTRS{idProduct}=="a005", RUN+="/usr/local/bin/serial-usb.sh"

    You may need to restart/reload udev by

    sudo /etc/init.d/udev restart
  • Mythtv Remote udev Rules

    Posted on March 22nd, 2009 wt8008 No comments

    I was looking at setting some udev rules for my remote for mythtv, so that if I change the input devices (i.e. add or remove a mouse/keyboard), I want the name of the device to be constant so that I do not need to modify my lirc configuration files.

    I tried to setup this before, when I first setup mythtv (see my earlier mythtv post), but I never got it to work. There were two issues, one is that the filename for the rules was wrong, and also I had issues with the rules themselves. Anyways here is how you do it…

    This is my complete /etc/udev/rules.d/10-localremote.rules file

    KERNEL=="event*",ATTRS{name}=="saa7134 IR (Avermedia AVerTV GO",SYMLINK="input/irremote"

    This will link /dev/input/irremote to the device that is associated with my tv tuner’s IR receiver.

    [email protected]:/dev/input$ ls -l irremote
    lrwxrwxrwx 1 root root 6 2009-03-22 15:06 irremote -> event3

    Right now, it points to event3, but if I plug in my mouse and keyboard irremote will then point to event5.

    The associated file /etc/lirc/hardware.conf should also have the REMOTE_DEVICE field point to the new device.

    There is some way to setup the remote using hal, but I will give that a try another day. See http://www.doctort.org/adam/general/update-on-twinhan-remote-for-mythbuntu-810.html I will give that a try another day.