• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: USB serial console over IP  (Read 3924 times)
moshiach
Guest
« on: April 20, 2009, 12:59:43 PM »

Does anyone know of a device that I can plug into the usb serial port on the plug and then into my network to access the plug console over ip?  I've found a 4 port USB temrinal server, but since it's quite expensive and the spcificatiosn don't give me enough informaiton to go on, I'd rather not purchase it just to find it doens't do what I need.

My goal is to get the sheevaplug down to the garage witht he rest of my network equipment but still be able to access the console from my upstairs office should I find a problem.
Logged

plugit
Global Moderator
Full Member
*****

Karma: 0
Posts: 139



View Profile
« Reply #1 on: April 20, 2009, 01:32:19 PM »

Another SheevaPlug! Cheesy
Logged

plugit
Global Moderator
Full Member
*****

Karma: 0
Posts: 139



View Profile
« Reply #2 on: April 20, 2009, 01:47:05 PM »

Not over IP, but you can get 40 or so meters out of something like this:

http://www.netshop.co.uk/productcategorydetail.aspx?CategoryID=53641&onspecialoffer=False
Logged

moshiach
Guest
« Reply #3 on: April 20, 2009, 02:10:34 PM »

Problem is that I am out of cat5 plugs in my home office.  I sw these and thought of routing it to an unused plug, but the the nearest one is in another room.
Logged

plugit
Global Moderator
Full Member
*****

Karma: 0
Posts: 139



View Profile
« Reply #4 on: April 20, 2009, 05:14:46 PM »

There are some fun things out there!

* Enables USB peripherals to be shared over a network
* Eliminates distance limitations of USB
* 10/100 Ethernet interface
* Supports DHCP, Static IP or Zeroconfig IP addressing
* Isochronous audio/video
* Full multi-function printer support

http://www.officenerds.com/product_info.php?products_id=56722

I want one!

Logged

moshiach
Guest
« Reply #5 on: April 20, 2009, 06:05:20 PM »

That's one of the ones I was looking at (Yes, I'm a big nerd) but the cost is prohibitive unless it really will let the sheeva console talk to me over ethernet.  So if someone want sto spring for one and let us all know.... Smiley
Logged

bzhou
Global Moderator
Newbie
*****

Karma: 0
Posts: 43


View Profile
« Reply #6 on: April 20, 2009, 08:12:28 PM »

Just get a nslu2 (or any small device with USB), plug console -> slug USB, dtach/screen picocom/minicom.
Logged

moshiach
Guest
« Reply #7 on: April 20, 2009, 10:46:26 PM »

Hmmm, I do have a slug sitting around here that I can reflash with the default firmware.   I'll have to give that a try.
Logged

moshiach
Guest
« Reply #8 on: April 21, 2009, 02:50:36 PM »

Thanks for the nudge bzhou.   Here you all go. 

1) Setup Nslug as usb terminal server.  You'll find this information well documented at http://www.nslu2-linux.org/wiki/SlugOS/HomePage and http://www.nslu2-linux.org/wiki/SlugOS/InstallandTurnupABasicSlugOSSystem  so I'll just go over the big picture.
   Flash latest slugos/be
   turnup init and setup networking
   reboot
   put in memstick, fdisk it and make filesystem
   turnup memstick -i /dev/sda1 -t ext2
   reboot  verify that /dev/sda1 is mounted as /
    Note:  To access the slug, you can easily use ssh.

2) Set the correct date on the slug.
Code:
export TZ=”mytimezone” #Hopefully you know the code to put here.  If not, keep it as UTC
date MMDDHHMMYYYY

3) After you've finished with the instructions at the second link, we still need to install a few packages. 
Opkg install tzdata
Code:
rm /etc/localtime
            ln -s /usr/share/zoneinfo/<yourtimezone> /etc/localtime
opkg install kernel-module-usbserial
opkg install kernel-module-ftdi-sio
opkg install picocom
opkg install screen
opkg install ntp
opkg install syslog-ng
Code:
update-rc.d -f syslog.buffer remove
update-rc.d -f syslog.file remove
update-rc.d -f syslog.network remove
update-rc.d -f syslog remove
            update-rc.d syslog-ng defaults
opkg install -force-overwrite logrotate

4) Setup the udev rule for the plug

Code:
nano -w /etc/udev/rules/10-sheevaplug
SYSFS{idProduct}=="9e8f",SYSFS{idVendor}=="9e88",ACTION=="add",RUN+="/sbin/modprobe -q ftdi-sio product=0x9e8f vendor=0x9e88",SYMLINK+"USB[0-1]"
ENV{PRODUCT}=="9e88/9e8f/500",ACTION=="remove",RUN+="/sbin/rmmod ftdi_sio usbserial"

Reload the udev rules
Code:
udevadm control --reload_rules

Plug in the Sheeva to the slug.  You should now have /dev/ttyUSB0 and /dev/ttyUSB1 and lsmod should show ftdi_sio and usbserial.  If not, go back to step 4 and type in the rules by hand instead of cut and paste.


5) Setup picocom
nano -w /etc/ports.config
Code:
1:jtag:115200  #No, this doesn't work
2:Sheeva:115200

nano -w /usr/bin/consolesh
Code:
#!/bin/sh

done=0

while [ $done -eq 0 ]; do
        clear
        echo "Welcome to $(hostname)"
        echo "Console Server"
        echo "  Uptime  :       $(uptime | cut -d, -f1 | cut -d' ' -f4-)"
        echo "  IP      :       $( /sbin/ifconfig eth0 | grep 'inet addr' | cut -d: -f2 | cut -d' ' -f1 )"
        echo ""
        echo "Connected ports:"
        ls /dev/ttyUSB* 2>&1 | grep -v no | cut -dB -f2 | while read P; do
                D=$(cat /etc/port.config | grep -E "^$(( $P + 1 )):" | cut -d: -f2)
                echo "  Port $(($P + 1))        :       $D"
        done
        echo ""
        echo -n "Please choose a port number to access, or '#' for shell --> "
        read PORT
        if [ "$PORT" == "" ]; then
                exit
        fi
        if [ "$PORT" == "#" ]; then
                echo "Spawning shell, type 'exit' to leave"
                sh
        else
                SPEED=$( cat /etc/port.config | grep -E "^${PORT}:" | cut -d: -f3 )
                /usr/bin/serial.sh $PORT $SPEED
        fi
done

exit
nano -w /usr/bin/serial.sh
Code:
#!/bin/sh
if [ $# -ne 2 ]; then
        echo "syntax: $0 portnumber speed"
        exit
fi
PORT=$(( $1 - 1 ))
echo "Escape sequence is Ctrl-A Ctrl-X"
picocom -b $2 -f h -p n -d 8 -r /dev/ttyUSB${PORT}

Make them executable
Code:
chmod +x /usr/bin/consolesh
chmod +x /usr/bin/serial.sh

At this point, you could create a user that has the shell /usr/bin/consolesh, but we are going to be using screen so that we have a scrollback buffer.  But just to test, run /usr/bin/consolesh and choose port 2.  You should get to the sheeva.  If you do, CTRL-A CTRL-X to close picocom, then just hit enter to get out of consolesh.

6)  Setup ld.so.conf
nano -w /etc/ld.so.conf
Code:
/opt/lib
then regenerate the cache with
Code:
ldconfig

7)  Setup syslog-ng

Change the configuration file
Code:
nano -w /etc/syslog-ng.conf
Replace the entire file with:

options { long_hostnames(off); sync(0); };
source src { pipe("/proc/kmsg");unix-stream("/dev/log"); internal(); };
destination messages { file("/opt/var/log/messages"); };
log { source(src); destination(messages); };
then restart syslog-ng
Code:
/etc/init.d/syslog-ng restart

Cool Setup ntp
Code:
nano -w /etc/ntp/ntp.conf
at the very least change the servers to use pool servers close to you:
Code:
#US Pool
server 0.us.pool.ntp.org
server 1.us.pool.ntp.org
server 2.us.pool.ntp.org

Or if you have an ntp server already setup (like on your Sheeva for instance)
Code:
server <hostname or ip address of sheeva>

9)  The final bit is screen.   Since it's already installed, just type
Code:
screen /usr/bin/serial.sh 2 115200

And you should be able to get into your connected plug.  Detach from the screen with CTRL-A D and you can ssh back into the slug at any time to reconnect with screen -r

At this point you could just reboot the slug.  As long as everything was done properly you should now have a working usb terminal server.  I suppose you could even add a hub to it, maybe a serial dongle or two and just by adding some more kernel moduels and entries to /etc/port.config and some changes to consolesh have yourself a way to serial console to any device in your garage from your office.   Pretty nifty.  And it only adds 3.5 watts to the whole setup.

« Last Edit: April 21, 2009, 08:29:28 PM by moshiach » Logged

bzhou
Global Moderator
Newbie
*****

Karma: 0
Posts: 43


View Profile
« Reply #9 on: April 21, 2009, 10:50:30 PM »

Why the need adding /opt/lib to /etc/ld.so.conf ?
You haven't installed any optware ipkg, even with optware ipkg, you don't need to do this.
Logged

moshiach
Guest
« Reply #10 on: April 22, 2009, 10:00:01 AM »

I'm overly complete.  Optware is added in there, just not in a visible step.
Logged

cdoban
Newbie
*

Karma: 0
Posts: 3


View Profile
« Reply #11 on: June 02, 2009, 10:51:43 PM »

It worked for me, but when boooting and you have to press a key to get to the u-boot prompt, input didn't work.
After several failed attempts, I tried minicom and it worked perfect.

Thanks,
Corneliu

Logged

Pages: [1]
Print
Jump to: