From brill@samson.math.uni-frankfurt.de Tue Jan 21 23:02:53 2003
Date: Wed, 22 Jan 2003 00:35:43 +0100 (MET)
From: Bjoern Brill <brill@samson.math.uni-frankfurt.de>
To: kal@users.sourceforge.net
Subject: sulu: patch to support more devices

Hello,

my girlfriend recently bought herself a tiny FlashRAM MP3 player with USB
port (called Chic MP10), to be fed with MP3s through my PC. I tried to get
it to work under Linux, but, how else could it be, it uses a proprietary
protocol with Windows-only drivers. Of course she didn't ask me before buying
the thingy. Oh well.

I couldn't find anything about that player and Linux on the Web, so I
started googling for strings I found in the driver binary in the hope to
find the chipset manufacturer or a compatible model with Linux support. One
of those strings was `YEPP', giving me Samsungs's product pages (showing a
very similar model) and finally your sulu program which claimed to drive
YEPPs under Linux, so perhaps also my girlfriend's player. And yes, after
changing the vendor/product id in the sources, it really worked (apart from
some messages about "unexpected recv buffer 2"). Great!!

The end result of this short story is the attached patch to sulu-0.0.8,
which adds the ids of her player (and two others), and also deals with the
unexpected recv buffers on a per device basis. For Uproar and YEPP devices,
things should work as before. One of the things I learnt on my quest through
the Web is that Samsung sells the microcontroller and and firmware used in
their YEPP line to other manufacturers, so I've made it easy to add more
devices later. 

Changes:
  - Introduce known_devices[] array, containing idVendor:idProduct of all
    supported devices, accompanied by flags for device-specific quirks.
    Add ids of YEPP-compatible Personal Telecom, INC. (PersTel) MP3 players.
    I only have access to a Chic MP10 (0x0e06:0xc001); the others appear
    in the .inf file of its Windows driver, so should work as well.
    Remove #define UPROAR_VENDOR, etc. -- no longer required.

  - Uproar_initialize(): Use known_devices[] instead of UPROAR_VENDOR, etc.
    Stop scanning USB devices when the first known device is found. We can't
    handle multiple devices anyway.

  - Set read_endpoint in Uproar_initialize() to value from known_devices[]
    instead of guessing it in uproar_recv().

  - Fix a debug message in uproar_recv().

  - Let Uproar_get_device_info() return model name _and_ firmware string,
    not one for the YEPP, the other for the Uproar.

  - Uproar_delete_track(), Uproar_reformat_memory(): the Chic needs another
    test for the second receive buffer. Do different tests depending on
    detected_device->protocol_variant.

  - Uproar_download(): since the infrastructure is there, reinstate the
    old (stronger) receive buffer test for the Uproar only. The Chic needs
    the weaker variant like the YEPP. (Actually, the only issue is that
    the Chic puts a 0x05 in the byte where the Uproar has 0x06. One could
    test for that, but who knows what other models put there.)

  - Add all supported vendor/product ids to notes/hotplug/usb.usermap .


With many thanks for writing sulu,

Bjoern Brill
--
Bj"orn Brill <brill@fs.math.uni-frankfurt.de>
Frankfurt am Main, Germany


