I am currently writing a compatibility layer to get the Linux >= 3.0
Android USB Composite driver working with Gingerbread (while it's
designed for ICS). I have made good progress so far (I have adb working
and integrated), except that I can't find out how to set the correct
device serial number (and USB vendor/product ID/String) to the driver.

I know that with ICS, this is done via getprop and sysfs node at init,
like on Galaxy Nexus init.rc:

on init
    write /sys/class/android_usb/android0/iSerial $ro.serialno

on boot
    write /sys/class/android_usb/android0/iManufacturer
$ro.product.manufacturer
    write /sys/class/android_usb/android0/iProduct $ro.product.model

So I looked at the Gingerbread driver and I have found that some of
these infos are board-specific (on platform_device struct):
#ifdef CONFIG_USB_ANDROID
        &s3c_device_android_usb,
which is:
struct platform_device s3c_device_android_usb = {
[…]
                .platform_data  = &android_usb_pdata,
[…]

with:

static struct android_usb_platform_data android_usb_pdata = {
        .vendor_id              = S3C_VENDOR_ID,
        .product_id             = S3C_UMS_PRODUCT_ID,
        .manufacturer_name      = "Samsung",
        .product_name           = "Nexus S",
        .serial_number          = device_serial,
[…]

So here are vendor/product id and manufacturer/product strings, but now
what about serial_number? It's defined as (in the same file):

static char device_serial[MAX_USB_SERIAL_NUM] = "0123456789ABCDEF";

So it apparently isn't set there.
The composite.c file has:

static char *iSerialNumber;
module_param(iSerialNumber, charp, 0);
MODULE_PARM_DESC(iSerialNumber, "SerialNumber string");

but AFAIK the driver isn't built as a module and isn't probed with args,
so it seems that it's not here either. 

Could anyone give me details about how that number is given to the USB
composite driver and/or how it's generated (user-space? kernel-side?).

-- 
Paul Kocialkowski, Replicant developer

Replicant is a fully free Android distribution

Website:        http://www.replicant.us
Wiki/Tracker:   http://redmine.replicant.us

-- 
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-kernel

Reply via email to