2010-10-12

SanDisk U3 flash drives - U3 removal

The U3 rubbish can be removed using Linux, without running the Windows tool. (Instructions found buried in the comments to this blog post:
http://www.theatreofnoise.com/2006/08/uninstall-u3-and-free-your-usb-drive.html
)

- Mount the U3 volume, and use the 'mount' command to get the device name (/dev/sr1 in my case).

- Change directory to /sys/class/block/sr1/device (change 'sr1' as applicable).

- Enter 'echo 1 > delete'.

- Voila!

2010-08-12

Digi Edgeport/8 persistent serial port assignments

Here's how to add arbitrary symlinks referencing specific ports:

In /etc/udev/rules.d/60-persistent-serial.rules , insert lines like the following just above the final LABEL (included for reference). (Obviously, you'll need to change it for the serial number of your own adapter). This example sets links for ports 5 through 8 (as labelled on the adapter box):


ENV{ID_SERIAL}!="Digi_International_Edgeport_8_I01845608-2", GOTO="persistent_serial_3"
ENV{ID_PORT}=="0",SYMLINK+="ttyBellows"
ENV{ID_PORT}=="1",SYMLINK+="ttyDetector"
LABEL="persistent_serial_3"
ENV{ID_SERIAL}!="Digi_International_Edgeport_8_I01845608-3", GOTO="persistent_serial_end"
ENV{ID_PORT}=="0",SYMLINK+="ttyMosaicGrating"
ENV{ID_PORT}=="1",SYMLINK+="ttySlit"

LABEL="persistent_serial_end"

2010-08-05

Digi Edgeport/8 persistent serial port assignments

Even better than patching usb-serial.ko is to use the /dev/serial/by-id links that are provided with recent versions of Udev.

In the case of Debian Lenny (5.0.4), where the version of Udev (125) is too old, patching /lib/udev/path_id as follows:

--- a/extras/path_id/path_id
+++ b/extras/path_id/path_id
@@ -515,6 +515,9 @@ handle_device () {
*/host[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*)
handle_scsi "$D"
;;
+ */ttyUSB*)
+ D=${D%/ttyUSB*}
+ ;;
*/usb[0-9]*/[0-9]*/*)
handle_usb "$D"
;;
and copying /lib/udev/60-persistent-serial.rules (the latter goes to /etc/udev/rules.d) provides the capability.

2010-05-18

How to do a remote installation of Debian 5.0.4 on a Dell Poweredge 2900 using the DRAC 5 Virtual Media feature

1. Update the DRAC firmware to the latest revision (System->Remote Access). I have 1.51

2. Install a 32-bit version of Firefox 3.0, along with 32-bit Java plugin. This allows the "Native" plug-in to be installed and work!

3. Download the Debian netinst iso image, and "connect" it (set "Auto-Attach").

4. Boot the server - press F11 so you can select the Virtual CD-ROM from the boot menu.

5. During the installation, the CD-ROM mount may fail. Start the shell from the installer menu, and mount /dev/sr1 on /cdrom. Check to make sure /cdrom shows the CD content.

6. After partitioning is complete, unmount /cdrom. (THis took forever to find out!)

2010-05-10

How to get a Digi Edgeport/8 working with RHEL/CentOS 5 - part 2

It turns out this wasn't the entire story. The device filenames that are created when the device is plugged-in (or at boot-up) depend on what other usb-serial devices are also connected, and which USB ports they are plugged into.

The standard advice is to use 'udev' to cause symlinks to be created that refer to the adapter ports independently of the kernel-assigned /dev/ttyUSBn names.

Unfortunately, in kernel 2.6.18, as shipped, this port information is not in the 'sysfs' database.

Fortunately, I found this patch, which enabled me to build an updated usb-serial.ko (using the procedure in the previous post).

Once installed, the following udev rules file /etc/udev/rules.d/11-edgeport.rules :

BUS=="usb",SYSFS{idVendor}=="1608",SYSFS{idProduct}=="0244",SYSFS{serial}=="*-0",NAME="%k",SYMLINK="ttyEDGE8_0_$sysfs{port_number}"`
BUS=="usb",SYSFS{idVendor}=="1608",SYSFS{idProduct}=="0244",SYSFS{serial}=="*-1",NAME="%k",SYMLINK="ttyEDGE8_1_$sysfs{port_number}"`
BUS=="usb",SYSFS{idVendor}=="1608",SYSFS{idProduct}=="0244",SYSFS{serial}=="*-2",NAME="%k",SYMLINK="ttyEDGE8_2_$sysfs{port_number}"`
BUS=="usb",SYSFS{idVendor}=="1608",SYSFS{idProduct}=="0244",SYSFS{serial}=="*-3",NAME="%k",SYMLINK="ttyEDGE8_3_$sysfs{port_number}"`

causes symlinks to be created like this:

lrwxrwxrwx 1 root root 7 May 10 14:53 /dev/ttyEDGE8_0_0 -> ttyUSB1
lrwxrwxrwx 1 root root 7 May 10 14:53 /dev/ttyEDGE8_0_1 -> ttyUSB2
lrwxrwxrwx 1 root root 7 May 10 14:53 /dev/ttyEDGE8_1_0 -> ttyUSB3
lrwxrwxrwx 1 root root 7 May 10 14:53 /dev/ttyEDGE8_1_1 -> ttyUSB4
lrwxrwxrwx 1 root root 7 May 10 14:53 /dev/ttyEDGE8_2_0 -> ttyUSB5
lrwxrwxrwx 1 root root 7 May 10 14:53 /dev/ttyEDGE8_2_1 -> ttyUSB6
lrwxrwxrwx 1 root root 7 May 10 14:53 /dev/ttyEDGE8_3_0 -> ttyUSB7
lrwxrwxrwx 1 root root 7 May 10 14:53 /dev/ttyEDGE8_3_1 -> ttyUSB8

2010-05-07

How to get a Digi Edgeport/8 working with RHEL/CentOS 5

The issue: although Edgeport USB-serial devices have in-kernel support, the changes for the Edgeport/8 didn't make it into 2.6.18 .

Thanks to some great support from Digi and the driver author, I was able to get this working perfectly on CentOS 5.4, although this ought to work on any RHEL5 or CentOS5 version.

First, follow the procedure for installing the kernel source and setting up a non-root user build area.

Prepare for module build with this procedure

Download this patchfile , then change directory to BUILD/kernel-2.6.18/linux-2.6.18.i686/drivers/usb/serial/ and use the 'patch' program to update the driver source.

Change directory to BUILD/kernel-2.6.18/linux-2.6.18.i686 and do 'make M=drivers/usb/serial' . Copy the resulting io_ti.ko module to /lib/modules/`uname -r`/kernel/drivers/usb/serial/

DON'T FORGET to run 'depmod -a' (like I did!), then reboot. You should see /dev/ttyUSB[0-7] created.

pyserial is handy for verifying the hardware is working correctly - I used the loopback test (test/test.py) from the source tarball.

2010-04-08

Quick and easy bootable DOS CD using Linux

I needed a DOS bootable CD to update the BIOS on a Dell server. The Dell executable was too large to fit on a 1.44MB floppy image, so many of the recipes I found wouldn't work. I ran across this page and adapted it to my needs. Here is a generic procedure:

0: Install mkisofs (and optionally qemu, if you want to test the image before burning).

1. mkdir freedos_livecd && cd freedos_livecd # or whatever name

2. wget -N http://www.mikerosoft.org/Utilities/FDOEMCD.builder.zip

3, unzip FDOEMCD.builder.zip && cd FDOEMCD/CDROOT

4. cp {files needed on CD} .

5. cd ..

6. mkisofs -o imagename.iso -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 \
-boot-info-table -N -J -r -c boot.catalog -hide boot.catalog -hide-joliet boot.catalog CDROOT

Done!

To test the image before burning:

qemu -localtime -boot d -cdrom imagename.iso # Ctrl-Alt to get your pointer back

Then burn it.