I finally got my IBM T21 usable under 2.6. I’m stuck using plain ol’ APM instead of ACPI, but it’ll now sleep when I want it to. Which was nice.

iPod Shuffle works under Linux

Very pleasantly surprised to find that Paul’s iPod Shuffle appeared as a bog standard USB mass-storage device on my Linux laptop. Of course, there’s the small matter of the metadata required to get it a Linux box to make acceptable playlist, but it’s a start.

I susect I’m being sad and old when I say I remember the COOL It Works With Linux logo scheme …

thinkpad t21, linux 2.4.28-gentoo-r5, and ACPI

If you find yourself running this kernel, make sure you remove all ACPI support from the kernel if you want to use the onboard 3Com Tornado 3c556B CardBus ethernet adaptor. You used to be able to get away with the acpi=off kernel parameter with 2.4.26-gentoo-rn kernels, but this doesn’t work any more.

This has been a Nerd Public Service Announcement.

CF Card Undelete for Linux

I hope you never need this. But this worked for me.

I accidentally deleted a bunch of files from the CF card that was in my card reader. I recovered them all perfectly.

First, before you do anything else, unmount the card’s file system. This will stop any additional changes being made to the card.

You’ll need to know:

  1. the device name of the card’s file system. It could be something as simple as /dev/sda1, or it could be something complex, like /dev/scsi/host1/bus0/target0/lun0/part1 (as it is with me).
  2. the names of the files you accidentally deleted. For example, if you deleted dsc_1017.jpg and dsc_1018.jpg in the dcim/100ncd70 directory, you’ll specify these as /dcim/100ncd70/dsc_1017.jpg and /dcim/100ncd70/dsc_1018.jpg.

First, check that the files can be undeleted:

# fsck.vfat -u /dcim/100ncd70/dsc_1017.jpg -u /dcim/100ncd70/dsc_1018.jpg /dev/scsi/host1/bus0/target0/lun0/part1

If you get the message Warning: did not undelete file ..., that’s a file that has been overwritten, perhaps in your camera. It’s gone; only the name remains. You won’t get it back.

Then, you can actually restore the files:

# fsck.vfat -r -u /dcim/100ncd70/dsc_1017.jpg -u /dcim/100ncd70/dsc_1018.jpg /dev/scsi/host1/bus0/target0/lun0/part1

If all goes well, your files will be back. Makes backups, and don’t do it again.

simple cheapo CF card adaptor and Linux

As I’m about to go (almost) entirely digital, I’m looking for ways of reading CF cards on my Linux-based ThinkPad. I was in Henry’s clearance store yesterday, and they had PCMCIA CF card readers for $10. I’ve found that it works well, though it took me a while to get it going. Here’s what I did:

You will need to install Card Services for Linux, if you haven’t already. After that’s done, you can check which cards are installed with cardctl ident:

Socket 0:
  product info: "Wireless Network CardBus PC Card", "Global", "", ""
  manfid: 0x0097, 0x8402
Socket 1:
  product info: "LEXAR ATA FLASH CARD     ", "STORM  ", "ST BM"
  manfid: 0x4e01, 0x0200
  function: 4 (fixed disk)

Ignore the Socket 0 output — it’s my wireless network card. The adaptor in socket 1 does contain a Lexar CF card; you’ll get a different message if yours is a different manufacturer.

If you don’t get this, it’s likely that (somehow) your system isn’t preloading the ide-cs module; check the /etc/pcmcia/config file, and read the various pcmcia-cs manual pages.

If you check the output of the kernel messages (with dmesg, or your tool of choice), you should see:


You’ll want to make a mount point for this disk, so mkdir -m777 /mnt/flash. Then you can edit /etc/fstab, and add:

/dev/hde1 /mnt/flash auto noauto,user,rw 0 0

From now on, you can access your camera’s CF card from /mnt/flash. No messing around with USB required!

iRiver H120


I’ve had the iRiver H120 for a few weeks now, and I think I’ve used enough of the functions to give it a fair appraisal. I bought it because it would make a good portable hard disk, which coincidentally would play MP3s on my long commute.

The device is basically a Toshiba 20GB mini hard drive with a direct USB2.0 connection to its FAT32 filesystem. It also supports USB1.1, which means that the H120 will interface (albeit slowly) to most machines you’d meet today.

This is how my Linux boxes identify the H120 on power up:

scsi3 : SCSI emulation for USB Mass Storage devices
  Vendor: TOSHIBA   Model: MK2004GAL         Rev: JC10
  Type:   Direct-Access                      ANSI SCSI revision: 02
Attached scsi disk sdb at scsi3, channel 0, id 0, lun 0
SCSI device sdb: 39063024 512-byte hdwr sectors (20000 MB)
 /dev/scsi/host3/bus0/target0/lun0: p1

It’s easy enough to figure out a mount point from this information.

I don’t think I have USB2.0 support quite figured out on my machine, as I find transfers to and from the H120 to be rather slow. Sometimes I find that large transfers time out, causing the device to remount read-only. A pain, but it does ensure that the filesystem doesn’t corrupt itself.

I couldn’t be happier with the sound quality. With all my MP3s encoded with LAME‘s standard preset, and using Sennheiser headphones, it sounds great. The H120 will play other file formats (Ogg, WMA and WAV), but I’m primarily interested in MP3s. Never quite got the Ogg thing, despite its open source credentials.

A lot of people complain about the H120’s lack of gapless playback between MP3s. Sometimes this bugs me a little, other times I don’t notice it. iRiver claim to be working on it, and it’s easy to upgrade the firmware when they do.

There are also options to use M3U playlists (which are absurdly easy to generate using the find, tr and sed commands — I must show you someday), and also an ‘iRiverDB’ database. I found the latter worse than useless; it increased startup time by over a minute, and seemed to get its genre recognition spectacularly wrong. At least it’s optional on the H120. I usually just play directories of files arranged by artist and album.

The H120 has a useful set of IO ports. In addition to its headphone and (proprietary) remote socket, there’s digital in and out, plus analogue line in and out, and external microphone input too. There’s also a built-in mike for voice recording. The digital in, when coupled to a CD player with digital out, allows you to rip even the most broken copy-controlled CD.

Last night I recorded The Decemberists at Lee’s Palace with the H120, and it came out quite well. I have a Sony ECM909A stereo microphone, which works better than it should for live taping. I recorded to 44.1kHz 16-bit stereo WAV (it can also do a variety of MP3 bitrates), and it’s nice to see the results sitting as files directly in the filesystem. There’s an (arbitrary?) limit of 74 minutes on WAV recordings, after which the H120 will go into record pause mode, and will start recording again on pressing a key.

My biggest complaint about recording with the iRiver is that there is no level meter, and no way of changing record level in mid-recording. I had to be very conservative with my record levels to make sure that last night’s recording didn’t clip, so I have a good — but quiet, though fixable with normalize — recording of the show. I took the iRiver community website‘s advice and recorded without the remote attached, and consequently got a noise-free record.

I also find the iRiver’s controls to be a little confusing, especially when you get to recording. I was forever accidentally knocking it into FM radio mode before the show started. For day to day playing, however, it works perfectly.

I’ve also found the remote to be a bit flimsy. Before I knew how careful I needed to be with it, one self-destructed in a subway turnstile. The main unit itself seems to be quite solid.

I’m very happy with my H120. It holds a decent part of my CD collection, it’s a handy portable hard drive, and it records with at least the same quality as my MD recorder. It may not have the caché of the iPod, but it also doesn’t have the “please mug me” white cables of the Apple box.

Addendum, June 14: The USB timing out problem has gone away now that I have compiled in USB2.0 support into my kernel; and transfers are extremely fast. This problem doesn’t seem to happen with my USB1.1 Thinkpad which, while slow, works perfectly with the H120.

iRiver, youRiver, hesheitRivers

I just bought an iRiver H120 portable hard disk/audio player/recorder. It seems to work quite well with Linux, so far. Even at over 9MB/s, it’s taking a while to transfer my music collection.

I bought it from the terribly-named G-Wiz store in Scarborough Town Centre. I think it might’ve been a store return — there was some truly execrable music on it (Eminem and Kylie Minogue … bleah!), and the packaging was slightly open. Hmm.

the tyranny of configure

I’m building Gentoo Linux on my laptop. Every little package that wants to build goes off and calls a configure script, as built by gnu autoconf. Every one checks the presence of features by compiling a little test program.

This gets slow. Quite why a system can’t cache autoconf results, and tell configure that it has this, that and the other. My computers seem to spend half their time somewhere in a configure script (serves me right for using Gentoo), but there has to be a better way than the status quo.

Toronto, the MFP enquiry, and Linux

At a Green Economics meeting last night, we heard from councillors Paula Fletcher and Glenn De Baeremaeker about the Toronto Computer Leasing Inquiry. It seems that the city is stuck with approximately 14000 Windows-NT class machines that it can no longer use, as Microsoft will not support its operating system.

I need to find out more on the specs of these machines, but I think it would be fair to say that they would be functional for most office applications with Linux. This has only been hinted at by other writers, but at least it could provide working, virus-proof computers to city staff at very little extra expense.

This could be something that the Toronto Linux User Group could look at.

Linux partition labels considered harmful

Most Unix systems, and Linux being one of them, use a configuration file called fstab to specify where the various disk drives are to appear on the system. Here’s an excerpt from one of mine:

 /dev/hda7     /             ext3    defaults        1 1
 /dev/hda1     /boot         ext3    defaults        1 2

The first column specifies the device name. In this case, /dev/hda is the first hard disk, and it has (amongst others) partitions 1 and 7.

More recently, however, it has been possible to label partitions. So instead
of the above, you might have:

 LABEL=/       /             ext3    defaults        1 1
 LABEL=BOOT    /boot         ext3    defaults        1 2

This seems like a good idea until you have to add in a hard drive, as I did recently. If both drives use the ‘LABEL=BOOT’ syntax, the system gets confused as to which drive to boot from, and hangs.

I’ve changed all my systems back to use the older, more cryptic ‘/dev/hd??’ method. I don’t intend to swap drives in and out, but at least this way, I’m ready if I have to.