![]() |
Adding a USB2Serial adaptor in Unslung or OpenSlugThere seems (to me) to be lots of wiki documentation about "tapping in" to the slug's hardware serial port (AddASerialPort), but very little about the "easier option" - using a prebuilt usb to serial adaptor. Who wants to get their hands dirty with a soldering iron?! ;-) USB adaptors:
For PL2303 chipset based USB to Serial adaptorsI found some references in the Palm page, so I thought I'd seperate out a proper HowTo page. According to the Palm instructions, it's just a case of:
If you are running Unslung, create the file
Notice: above works for Newlink USB Serial adaptor available from Maplin UK code ZP43. For OpenSlug, add one line for each module that should be loaded at startup to
Special Note about the kernel-module-pl2303 in Unslung.There appears to be different versions of the pl2303 chip in USB to Serial Adapters. If you find that the dmesg command displays error messages about the pl2303 (e.g. "pl2303.c: pl2303_read_int_callback - usb_submit_urb failed with result -22") you should get a new version of the driver pl2303.o. For information see Message #7954 at http://www.nslu2-linux.org. (http://tech.groups.yahoo.com/group/nslu2-linux/message/7954) The URL referenced in the above message is: http://www.fh-furtwangen.de/~dersch/pl2303.o How to install the driver:
I have found two USB to Serial Adapters with the pl2303 chip that work well with Unslung. These are: USB to Serial (9-pin) DB-9 RS-232 Adapter Cable.
(braydw) For Keyspan based USB to Serial adaptorsFor a keyspan USB serial port use these instructions UseKeyspanSerialPorts For Belkin F5U109 USB to Serial adaptorsdmesg should have reported this as being detected. However, this didn't work for my adaptor (a Belkin F5U109), and some google searching found me this page: http://www.qbik.ch/usb/devices/showdev.php?id=780 which suggested I needed the mct_u232 driver rather than the pl2303 driver. So I tried a quick:
and it came back with "Cannot find package kernel-module-mct_u232.". I wondered if maybe it had a different name under Unslung, so I did a:
and after looking through the returned list found that the command I wanted was in fact:
So then after I'd installed the correct driver (and I did "rmmod pl2303; ipkg remove kernel-module-pl2303" for the sake of tidyness), I ran:
(confusingly, the module itself still uses an underscore even though the ipkg doesn't!)
And got the happy output: usbserial.c: USB Serial support registered for Magic Control Technology USB-RS232 usbserial.c: Magic Control Technology USB-RS232 converter detected usbserial.c: Magic Control Technology USB-RS232 converter now attached to ttyUSB0 (or usb/tts/0 for devfs) mct_u232.c: Magic Control Technology USB-RS232 converter driver v1.1 If you are running Unslung, create the file
For OpenSlug, add one line for each module that should be loaded at startup to
For FTDI chipset based USB to Serial adaptors (http://www.ftdichip.com/)
If you are running Unslung, create the file
For OpenSlug, add one line for each module that should be loaded at startup to
NOTE: If For Genuine Nokia CA-42 USB to Serial adaptors, and some othersThe Nokia CA-42 (but not clones thereof), use a chip which supports the usbcdc protocol (standard serial adaptor USB "class"), which the Linux usbserial driver supports, but you may have to manually bind the driver to - check the USB product and vendor codes using the lsusb command, and then issue a command like "insmod usbserial vendor=0x0421 product=0x0802" before inserting the adaptor. General tipsIf you have a Linux PC you can sometimes use it to help answer the question of which module you need; your PC probably has all of the modules available and will auto-detect which to use. So if you plug in your serial cable (or whatever, this applies to most peripherals) and look at dmesg or syslog etc you may well see the name of the kernel module that you need to load on your Slug. When you buy a USB-serial converter, note that some are much superior to others. Some implement the flow control signals while others don't; some output proper RS232 voltage levels (+/- 5V) while others only swing between 0V and 5V. In my limited experience, physically larger converters are more likely to contain the extra circuitry needed for voltage level shifting, and products based on the FTDI chips are likely to be of higher quality. Now What?Atter installing the USB2SERIAL, what can I do with it? 1. TERMINAL Download minicom, or for a stripped down version picocom. ipkg install picocom (eg picocom -b 9600 /dev/ttyUSB0) ipkg install minicom getty considerationsI used a USB serial port and ran getty on it, but the serial port was not always plugged in (I sometimes plugged in an Ethernet port instead; there wasn't room on the hub for both). Unfortunately, running getty when the port is not plugged in has two problems, (1) after a while it's polled only every 5 minutes, which means you have to wait when you plug it back in, and (2) sometimes the getty creates a huge amount of wtmp log entries, causing disk writes every 5-10 seconds or so and huge log files (which is especially a problem if you're running on a Flash disk). The solution is to add a level of indirection: in /root/usb-login.sh: #!/bin/sh while ! test -e /dev/ttyUSB0; do sleep 10; done exec /sbin/getty -L ttyUSB0 -h 115200 ansi then chmod +x /root/usb-login.sh and put in inittab: T0:23:respawn:/root/usb-login.sh NOTE: if you need other settings for getty under SlugOS 4.8, type |