NSLU2-Linux
view · edit · print · history

Peripherals.UseKeyspanSerialPorts History

Hide minor edits - Show changes to markup

November 26, 2006, at 03:10 PM by fcarolo -- warning about links to keyspan site
Added lines 116-117:

Notice: the above links to http://www.keyspan.com/support/linux/ are no longer working as of November 26th, 2006.

February 14, 2006, at 09:55 AM by tman --
Changed lines 48-49 from:
    if [ "`/sbin/lsmod | grep 'keyspan' | sed  -e'N;s/[0-9]*//g;s/[ \n]*/ /g'`" = ' keyspan (unused) usbserial [keyspan] ' ]; then
to:
    if [ "`/sbin/lsmod | grep 'keyspan' |  sed  -e'N;s/[0-9]*//g;s/[ \n]*/ /g'`" = ' keyspan (unused) usbserial [keyspan] ' ]; then
Changed lines 114-115 from:

The manufacturer's site is www.keyspan.com/support/linux/ Keyspan Linux Drivers

to:

Keyspan provide Linux drivers on their website.

February 12, 2006, at 03:07 PM by tlhackque -- make mfg site url visible
Changed lines 113-114 from:

The manufacturer's site is Keyspan Linux Drivers

to:

The manufacturer's site is www.keyspan.com/support/linux/ Keyspan Linux Drivers

December 19, 2005, at 08:04 AM by tlhackque -- Change to S11KeyspanDriver for bind compatibility
Changed lines 10-12 from:

at startup. Just copy it to /opt/etc/init.d/S01KeyspanDriver, and don't forget to chmod +x /opt/etc/init.d/S01KeyspanDriver

to:

at startup. Just copy it to /opt/etc/init.d/S11KeyspanDriver, and don't forget to chmod +x /opt/etc/init.d/S11KeyspanDriver

Changed line 25 from:

/opt/etc/init.d/S01KeyspanDriver

to:

/opt/etc/init.d/S11KeyspanDriver

Changed lines 113-114 from:

The manufacturer's site is Keyspan Linux Drivers

to:

The manufacturer's site is Keyspan Linux Drivers

December 19, 2005, at 07:27 AM by tlhackque -- Document and provide install script for mwester\\
Added lines 1-117:

Keyspan USB -> serial port adapters are easy to find commercially.

However, unslung doesn't have a driver. Until now.

I found the sources, but it took mwester, who had the kernel build environment, to get one built. Many thanks!

Until it makes it into the standard builds (I hope), here is a startup script that will add it to an unslung system & install the kernel modules at startup. Just copy it to /opt/etc/init.d/S01KeyspanDriver, and don't forget to chmod +x /opt/etc/init.d/S01KeyspanDriver

You can run it by hand, or simply reboot.

The script is setup to download just once -- this is to be courteous to mwester and his ISP.

If you want to inhibit startup without uninstalling the kit, simply touch /opt/keyspan/.noserial

The devices are /dev/ttyUSB{0-n}

(:table border=0 width=100% bgcolor=#b0e0e6:) (:cell:) /opt/etc/init.d/S01KeyspanDriver

 

#!/bin/sh
#
# Start the Keyspan Serial Port Driver
#

# Create the kit directory if required

if [ ! -d /opt/keyspan ]; then
    mkdir /opt/keyspan
fi

# Check to see if startup is inhibited.  Exit silently if so.

if [ -e /opt/keyspan/.noserial ]; then
    exit
fi

# Don't disturb running drivers unless function is "reload"

if [ "$1" != 'reload' ]; then
    if [ "`/sbin/lsmod | grep 'keyspan' | sed  -e'N;s/[0-9]*//g;s/[ \n]*/ /g'`" = ' keyspan (unused) usbserial [keyspan] ' ]; then
        echo "Keyspan: already loaded"
        exit
    fi
fi

# Download drivers if needed.  Only do this once.
# .downloaded is used to allow common image NSLU2 kits

if [ ! -e /opt/keyspan/.downloaded ]; then
    echo "Keyspan: drivers not installed, downloading..."
    if wget -q http://users.dls.net/~mwester/unslung/keyspan.o -O/opt/keyspan/keyspan.o && \
       wget -q http://users.dls.net/~mwester/unslung/usbserial.o -O/opt/keyspan/usbserial.o ; then
        touch /opt/keyspan/.downloaded
    fi
fi

# Make sure both modules are present

if [ ! -e /opt/keyspan/keyspan.o ]; then
    echo "Keyspan: kit not installed"
    exit
fi
if [ ! -e /opt/keyspan/usbserial.o ]; then
    echo "Keyspan: kit not installed"
    exit
fi

# Identify the active kernel module library

KLIB="/lib/modules/`cat /proc/sys/kernel/osrelease`/kernel/drivers/usb/serial"

# Unload the distributed usbserial (it's missing a couple of routines)

if [ "`/sbin/lsmod | grep keyspan`" != '' ]; then
    echo "Keyspan: unloading Keyspan port driver"
    /sbin/rmmod keyspan
fi
if [ "`/sbin/lsmod | grep usbserial`" != '' ]; then
    echo "Keyspan: unloading USB serial port class driver"
    /sbin/rmmod usbserial
fi

# Backup the distributed version, just in case

if [ ! -e $KLIB/usbserial-v55.o ]; then
    echo "Keyspan: backing-up standard usbserial as usbserial-v55"
    mv $KLIB/usbserial.o $KLIB/usbserial-v55.o
fi

# Install the new drivers

echo "Keyspan: loading drivers"
cp /opt/keyspan/usbserial.o $KLIB/
cp /opt/keyspan/keyspan.o $KLIB/

insmod usbserial
insmod keyspan

# The serial ports appear as /dev/ttyUSB{0-n}

#EOF

(:tableend:)

The manufacturer's site is Keyspan Linux Drivers

Enjoy.

--tlhackque

view · edit · print · history · Last edited by fcarolo.
Based on work by tman and tlhackque.
Originally by tlhackque.
Page last modified on November 26, 2006, at 03:10 PM