tHog

U3 information (mainly for Linux)

Introduction

On 2007-01-01 I got my hands on a 1-gigabyte Kingston flash drive with U3 'smart' technology. Actually I swapped my plain version with a friend who had trouble with the U3 stuff on her Mac, and thought it might turn out an interesting hack ;)

Technical background

As far as I know, the idea behind U3 is to expand the already hideous autorun feature from CDs further into USB flash drives. It's being marketed as to enable features like portable applications, which could just as well run from a plain flash drive. Since Windows can only autorun CDs, U3 drives present themselves as having a CD device holding an ISO9660 filesystem. So this fancy new hardware has been developed to patch software shortcomings... shouldn't it be the other way around? :-/

The two devices/filesystems share the single flash chip, and the firmware presents them as separate devices to the host computer hardware and OS. An uninstall application will delete the CD part, freeing the space for use with the plain drive; the filesystem will probably have to be re-created from scratch.

Why would you hack on it?

There is more hardware than in a plain flash drive. It should be used for something more, not less. It should be hacked because it's there, like Mount Everest ;)

On the other hand, U3 reeks a little like DRM and/or copy protection in the sense that it has more technology but arguably less utility. In other words it's technology that works against itself, or against the world's general technological development. It's a sad state of affairs, so there is a moral imperative to correct it somehow :) At the very least, I would like to have the control to disable U3 altogether.

There's one side about U3 that could potentially be slightly useful. Since flash has limited write cycles and it has to be erased as full blocks, it makes some sense to use it like a CD-RW rather than a full random read/write medium. Of course, CD-RW is a bad idea if you have to burn the whole hog again to change one byte. But this is what happens in a block of flash anyway, as a single byte cannot be erased. Then again, the answer should not be unnecessary crippling of the medium beyond its natural limitations.

Why not hack it?

Because you can simply uninstall it. Unfortunately this only works on Windows. I did this on 2007-01-04 as a part of a silly little Windows experiment, since I'm not too interested in working on it :-/

Linux experiments

So far I've only used the hardware on my Linux machine. The U3 stuff doesn't present any annoyances, and the plain-drive part works even for a Gentoo LiveUSB. I'd like to get rid of the CD part though, since the point of these flash drives is sneakernetting between various systems and I shudder at the thought of pop-up installers upon inserting this drive into a Windows machine.

Linux CD-part access

Reading this far, you probably know that Linux handles USB drives via the SCSI driver layer. There's a SCSI option in the kernel menuconfig that you may have to turn on in order to access the CD part:

[*] Probe all LUNs on each SCSI device
This means CONFIG_SCSI_MULTI_LUN=y in the kernel .config file. Without it, Linux only sees the plain drive (which, btw, is a sensible fallback design :) It may be already set on your system; try if you get a SCSI CDROM when inserting the drive. This way I could mount the CD part as an ordinary ISO9660 filesystem.

The CD part appears as a CD writer, which makes sense as you can change the contents via (proprietary Windows-only) software. Cdrecord fails with the following message:

# cdrecord -dev=/dev/sr0 -v -driveropts=burnfree blank=fast ~teknohog/u3new.iso 
dvdrtools v0.3.1
Portions (C) 2002-2006 Ark Linux 
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program; see the file COPYING.  If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
Based on:
Cdrecord 1.11a15 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jörg Schilling
TOC Type: 1 = CD-ROM
scsidev: '/dev/sr0'
devname: '/dev/sr0'
scsibus: -2 target: -2 lun: -2
Scanning device, b=4294967295
Linux sg driver version: 3.5.27
Using libscg version 'bero-0.5a'
cdrecord: Warning: using inofficial version of libscg (bero-0.5a '@(#)scsitransp.c      1.81 01/04/20 Copyright 1988,1995,2000 J. Schilling').
Driveropts: 'burnfree'
atapi: 1
Device type    : Removable CD-ROM
Version        : 0
Response Format: 2
Capabilities   :
Vendor_info    : 'Kingston'
Identifikation : 'DataTraveler U3 '
Revision       : '6.50'
Device seems to be: Generic mmc CD-R.
resid: 236
cdrecord: Warning: controller returns zero sized CD write parameter page.
cdrecord: Warning: controller returns wrong size for CD write parameter page.
cdrecord: Warning: controller returns wrong page 0 for CD write parameter page (5).
cdrecord: Warning: controller returns zero sized CD write parameter page.
cdrecord: Warning: controller returns wrong size for CD write parameter page.
cdrecord: Warning: controller returns wrong page 0 for CD write parameter page (5).
Using generic SCSI-3/mmc CD-R driver (mmc_cdr).
Driver flags   : SWABAUDIO BURNFREE
Supported modes:
FIFO size      : 4194304 = 4096 KB
cdrecord: Drive does not support TAO recording.
cdrecord: Illegal write mode for this drive.
So this doesn't work as the U3 uninstaller directly. In addition to other non-standard issues, you couldn't simply burn any size of an ISO since the controller has to keep track of the CD/plain-drive boundary. For now the safest option might be to try and overwrite an ISO of similar size without any Windows crud. For example these guys are attempting something along the lines.


Risto A. Paju