Topic: USB Wi-Fi Adapter

I'm trying to use a Chumby with a USB Wi-Fi adapter (the internal Wi-Fi is disabled; this is a hacked Botball Chumby).  My USB Ethernet adapter works fine following the instructions on the wiki, but I have not found any similar instructions for a Wi-Fi adapter.  The model is a D-Link WUA-1340, and I'm pretty sure it uses the rt73 chipset, which should be supported on the Chumby from what I've read.

What I'm doing now is inserting the adapter, turning on the Chumby, and running the start_control_panel script.  The Control Panel does not see any networks, and the MAC address of the NIC shows up as all 0's.

My Chumby's boot scripts are heavily modified by the Botball people, so it's quite possible that some standard Chumby driver or script which the adapter needs aren't being loaded.  If there's a specific command that the default Chumby boot scripts call that is needed, does anyone know what that is?

Any help would be appreciated.  (And if possible, n00b-friendly advice would good... I'm not particularly familiar with Linux.)

Thanks.

Re: USB Wi-Fi Adapter

I'm not familiar with the modifications to the boot script that have been done, but if the method used to disable the internal adapter was to not load the rt73 driver, then that would certainly explain why your adapter is not recognized.

Do you have a link to more information about this particular modification?

We don't officially support two rt73-based devices plugged into the device at the same time - we are aware of some potential driver issues with that particular configuration.

Re: USB Wi-Fi Adapter

Hi Duane,

Here is rcS:

#!/bin/sh

PRINT=/psp/rfs1/fb_print
chmod +x /psp/rfs1/fb_print

export LD_LIBRARY_PATH=/lib

echo "Starting udevd as daemon"
/sbin/udevd --daemon

# wait for USB subsystem to finish loading
/usr/chumby/scripts/wait_for_usb

echo "CBC Internal Boot Script" | $PRINT

mkdir -p /mnt/usb

internal=""
upgrade=""
maybe_internal=""

for i in /sys/block/sd*; do
  dev=`echo $i | sed 's/\/sys\/block\///'`;
  mount /dev/${dev}1 /mnt/usb -t vfat -o ro
  
  if [ -e /mnt/usb/userhook0 ]; then
    type=`/mnt/usb/userhook0 --type`
    
    if [ "${type}" == "Upgrade" ]; then
      upgrade=${dev}
    elif [ "${type}" == "Firmware" ]; then
      internal=${dev}
    else
      maybe_internal=${dev}
    fi
  else
    maybe_internal=${dev}
  fi

  umount /mnt/usb
done

if [ -z "${internal}" -a -n "${maybe_internal}" ]; then
  internal=${maybe_internal}
fi

if [ -z "${internal}" ]; then
  echo "Could not find any internal drives!" | $PRINT
  exit 1
fi

if [ -z "${upgrade}" ]; then
  mount /dev/${internal}1 /mnt/usb -t vfat -o ro
  
  if [ -e /mnt/usb/userhook0 ]; then
    . /mnt/usb/userhook0 ${internal}
    exit 0
  else
    echo "Could not find boot script!" | $PRINT
    exit 1
  fi
fi

mount /dev/${upgrade}1 /mnt/usb -t vfat

/mnt/usb/userhook0 --upgrade ${internal} &
exit 0

Here is /mnt/usb/userhook0:

#!/bin/sh

ROOT=/mnt/usb

PRINT=$ROOT/fb_print
VERSION=`cat $ROOT/FIRMWARE_VERSION`


if [ "$1" == "--version" ]; then
  echo $VERSION
  exit 0
elif [ "$1" == "--type" ]; then
  echo Firmware
  exit 0
fi

echo "CBC Firmware Version $VERSION" | $PRINT --echo

if [ ! -e /psp/rfs1/rcS ]; then
  echo "Updating internal boot script..." | $PRINT
  mkdir -p /psp/rfs1
  cp $ROOT/rcS /psp/rfs1
  cp $ROOT/fb_print /psp/rfs1
  chmod +x /psp/rfs1/rcS
  chmod +x /psp/rfs1/fb_print
  sync
  sync
  reboot
fi

if [ -z "$1" ]; then
  echo "BUG: Didn't get a device from rcS" | $PRINT --echo
  exit 1
fi

INTERNAL_DEVICE=$1

#
# Set up loopback
#
ifconfig lo 127.0.0.1

#
# Set up wired network
#
echo "Checking for network" | $PRINT
echo "Starting wired network driver"
insmod /drivers/pegasus.ko
echo "Starting DHCP on eth0"
udhcpc eth0

#
# Set up wireless network
#
echo "Starting wireless network driver"
insmod /drivers/rt73.ko
if [ -e /mnt/usb/network_config ]; then
    cp /mnt/usb/network_config /psp
    /usr/chumby/scripts/start_network &
else
    if [ -e /psp/network_config ]; then
        /usr/chumby/scripts/start_network &
    else
        ifconfig rausb0 up
    fi
fi

#
# Display network interfaces
#
ifconfig
ifconfig | grep inet | grep -v 127.0.0.1 | sed 's/Bcast.*//' | $PRINT

# sshd
echo "Starting sshd"
/sbin/sshd

# Touch screen and sensors
hwversion=`/usr/chumby/scripts/chumby_version -h`
if [ "$hwversion" == "3.8" ]; then
    # touch screen
    insmod /drivers/chumby-tsc2100.ko version038=1

    # chumby sensor driver
    insmod /drivers/chumby_sense1.ko version038=1
else
    # touch screen
    insmod /drivers/chumby-tsc2100.ko

    # chumby sensor driver
    insmod /drivers/chumby_sense1.ko
fi
echo "Chumby hardware version $hwversion" | $PRINT --echo

#
# USB HID: keyboard / mouse
#
echo "Starting USB HID"
insmod /drivers/usbhid.ko

insmod /drivers/chumby_udma.ko
insmod /drivers/chumby_timer.ko
mknod /dev/timerx c `cat /proc/devices |awk '/timer/ {print $1}'` 0
mknod /dev/timerm c `cat /proc/devices |awk '/timer/ {print $1}'` 1

# chumby switch
mknod /dev/switch c `cat /proc/devices |awk '/switch/ {print $1}'` 0

# chumby udma
mknod /dev/udma c `cat /proc/devices |awk '/udma/ {print $1}'` 1

# set paranoid boot flag/semaphore
echo "Clearing paranoid boot flag"
/bin/eraseall /dev/mtd7
nandwrite /dev/mtd7 /usr/chumby/msp_00_64k_no_oob.bin 0x70000

echo "Disabling touchscreen touchclick"
echo 0 > /proc/chumby/touchscreen/touchclick

echo "Loading CBOB SPI module"
insmod /mnt/usb/cbob_spi.ko
mknod /dev/cbob c 251 0

KISS=/mnt/kiss
USER=/mnt/user

KISS_DEV=/dev/${INTERNAL_DEVICE}2
USER_DEV=/dev/${INTERNAL_DEVICE}3

echo "Adding ext2 driver"
insmod /mnt/usb/ext2.ko

restore_time

echo "Enabling audio"
insmod /drivers/snd-rawmidi.ko
insmod /drivers/snd-seq-midi.ko
insmod /drivers/snd-usb-lib.ko
insmod /drivers/snd-hwdep.ko
insmod /drivers/snd-usb-audio.ko

echo -n "Checking internal filesystems..." | $PRINT
/mnt/usb/fsck.ext2 -y ${USER_DEV} | $PRINT
echo "done." | $PRINT

echo -n "Mounting internal filesystems..." | $PRINT

mkdir -p $KISS
mkdir -p $USER

mount ${KISS_DEV} ${KISS} -t ext2 -o ro
mount ${USER_DEV} ${USER} -t ext2

save_time

echo "done."

echo "" | $PRINT --echo
echo "Boot complete" | $PRINT --echo

/mnt/kiss/startup.sh &

exit

/mnt/kiss/startup.sh just launches the Botball GUI, and I'm pretty sure anything after that point is irrelevant with regards to Wi-Fi drivers.

/mnt/usb and /mnt/kiss are partitions on an internal 1GiB flash drive which was added by Botball.

rt73.ko appears in userhook0, so I think they're doing something with the driver.  I don't have an official Chumby boot script to compare with, so I can't tell if they initialize the driver the same way that Chumby does.  I believe that the Wi-Fi card that the Chumby contains is physically removed from the Botball Chumbies, but I don't know this for a fact.  People whom I have talked to tell me that they are unable to get the Botball Chumby to recognize an internal Wi-Fi card, and they think this is because it's removed.  If there is a Wi-Fi card still in the Botball Chumby, and you can tell me how it might be accessed, that would be even better.

Thanks!

Re: USB Wi-Fi Adapter

Based on what you posted, it appears they're removed the internal USB wifi adapter and replaced it with a 1G USB memory stick.

Taking a superficial look at the script, it would seem that it is indeed installing the rt73 driver and running the correct scripts, however, it's the case that the driver does not recognize your particular dongle as an RT73-based device.  The driver relies on the USB subsystem knowing the USB vendor/model codes to match with the appropriate driver.

The USB vendor/model code for your device is 07d1:3c04, which is not in the list of USB codes recognized by our driver - it *does* recognize 07d1:3c03, which is another RT73-based  device also made by D-link, the "DWL- G122".  A quick Google search indicates that many people are having similar issues with your device under some distributions of Linux.

One solution is to download the source of the driver from our server, add the USB codes to the table in "rtmp_def.h", recompile, and modify userhook0 to load it from /mnt/usb instead of /drivers.

Another solution is to acquire an adapter that's recognized by the current driver - the one we use is an Xterasys XN-3135G which should be readily available.

I'll file an enhancement request to add this USB code to the driver, but that doesn't solve your immediate problem.

Re: USB Wi-Fi Adapter

Hi Duane,

I'm on Windows, so I couldn't use the cross-compiler, but I got a friend on Linux to make the change to the driver and recompile.  And now it works!  I haven't tried connecting to a network yet, but it sees my Wi-Fi network (and my neighbors'), so I'm pretty sure it's fixed.  Thanks for the help!

Re: USB Wi-Fi Adapter

You're very welcome.  Good luck!