1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

usb rs232 serial port?

Discussion in 'Cisco/Linksys Network Storage Devices' started by mdsilva, Sep 13, 2009.

  1. mdsilva

    mdsilva Addicted to LI Member

    Hi does anyone know if a usb to rs232 adapter will work on the nas200? :confused:

    I would like to use that to monitor some devices in the room

    :ninja: MD :ninja:
     
  2. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    The standard NAS200 can't do it. But on my firmware, this is not a difficult feature to add. As a matter of fact, the necessary modules are apparently already part of the kernel config. I noticed that the drivers/usb/serial directory of the kernel in my build tree already had all the necessary .ko files, so I put them in a tarball and uploaded it to this location.

    AFAIK, virtually all USB-based serial ports are based on FTDI chips, so you will probably only need to unpack and use the usbserial.ko and ftdi_sio.ko files, and add nodes to the /dev directory.

    Code:
    $ insmod usbserial.ko
    Using usbserial.ko
    $ insmod ftdi_sio.ko
    Using ftdi_sio.ko
    $ cat /proc/devices
    Character devices:
      1 mem
      2 pty
      3 ttyp
      4 /dev/vc/0
      4 tty
      4 ttyS
      5 /dev/tty
      5 /dev/console
      5 /dev/ptmx
      7 vcs
     10 misc
     13 input
     21 sg
     60 /dev/usb_button
     61 copy_button
     62 power_button
     89 i2c
     90 mtd
    128 ptm
    136 pts
    180 usb
    188 ttyUSB
    189 usb_device
    
    Block devices:
      1 ramdisk
      7 loop
      8 sd
      9 md
     31 mtdblock
     65 sd
     66 sd
     67 sd
     68 sd
     69 sd
     70 sd
     71 sd
    128 sd
    129 sd
    130 sd
    131 sd
    132 sd
    133 sd
    134 sd
    135 sd
    252 mmc
    253 device-mapper
    254 mdp
    $ for x in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
    > do mknod /dev/ttyUSB$x c 188 $x
    > done
    
    You sound like you know what you're doing, so I think this should be enough information to take it from here. Good luck! :cool:

    ===Jac
     
  3. mdsilva

    mdsilva Addicted to LI Member

    Nice! Thanks, will try it when i get some free time.

    MD
     
  4. mdsilva

    mdsilva Addicted to LI Member

    Hi JaC (and others), am a little stuck, I did everything above and did not get any errors but am not able to cat /dev/ttyUSBn.

    Here is my part of my dmesg
    Code:
    usbcore: registered new interface driver usbserial
    drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
    usbcore: registered new interface driver usbserial_generic
    drivers/usb/serial/usb-serial.c: USB Serial Driver core
    drivers/usb/serial/usb-serial.c: USB Serial support registered for FTDI USB
    Serial Device
    usbcore: registered new interface driver ftdi_sio
    drivers/usb/serial/ftdi_sio.c: v1.4.3:USB FTDI Serial Converters Driver
    
    Any ideas on what I've missed? :confused:
     
  5. mdsilva

    mdsilva Addicted to LI Member

    Hi again, if i unplug it and plug it back in i get this in dmesg

    Code:
    ohci_hcd 0000:00:0a.0: auto-wakeup
    usb 2-2: new full speed USB device using ohci_hcd and address 6
    usb 2-2: device descriptor read/64, error -62
    usb 2-2: device descriptor read/64, error -62
    usb 2-2: new full speed USB device using ohci_hcd and address 7
    usb 2-2: device descriptor read/64, error -62
    Fan is off.
    usb 2-2: device descriptor read/64, error -62
    usb 2-2: new full speed USB device using ohci_hcd and address 8
    usb 2-2: device not accepting address 8, error -62
    usb 2-2: new full speed USB device using ohci_hcd and address 9
    usb 2-2: device not accepting address 9, error -62
    
    my rs232 is pluged into usb port 1
    my usb stick is plugged into usb port 2 and is mounted on boot time
     
  6. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    Can you paste the script (or manual commands) that you use before you connect the FTDI serial port to the NAS? Without knowing what it is you're doing, we can't tell what you're doing wrong.:sad:

    Besides using cat, you may need some other software too, to set the serial port parameters such as baud rate and number of data bits, stop bits and parity.

    ===Jac
     
  7. mdsilva

    mdsilva Addicted to LI Member

    Hi JaC,

    Here is my script, it's still a work in progress

    usb-serial:
    Code:
    #!/bin/sh
    
    insmod -q usbserial.ko
    insmod -q ftdi_sio.ko
    #device="`cat /proc/devices | grep ttyUSB | tr -d ' ttyUSB'`"
    for x in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
            #do mknod /dev/ttyUSB$x c $device $x
            do mknod /dev/ttyUSB$x c 188 $x
    done
    
    My mount script for my usb drive from rc.d directory (incase its handy):
    Code:
    mkdir /harddisk/usb >/dev/null 2>&1
    echo '/dev/sdd1 /harddisk/usb ext2 defaults 1 1' >> /etc/fstab
    mount /harddisk/usb >/dev/null 2>&1
    
    MD
     

Share This Page