int num_functions;
char **functions;
+ int vendor_id;
int product_id;
int version;
};
return 1;
}
+static int get_vendor_id(struct android_dev *dev)
+{
+ struct android_usb_product *p = dev->products;
+ int count = dev->num_products;
+ int i;
+
+ if (p) {
+ for (i = 0; i < count; i++, p++) {
+ if (p->vendor_id && product_matches_functions(p))
+ return p->vendor_id;
+ }
+ }
+ /* use default vendor ID */
+ return dev->vendor_id;
+}
+
static int get_product_id(struct android_dev *dev)
{
struct android_usb_product *p = dev->products;
{
struct android_dev *dev = _android_dev;
struct usb_gadget *gadget = cdev->gadget;
- int gcnum, id, product_id, ret;
+ int gcnum, id, ret;
printk(KERN_INFO "android_bind\n");
usb_gadget_set_selfpowered(gadget);
dev->cdev = cdev;
- product_id = get_product_id(dev);
- device_desc.idProduct = __constant_cpu_to_le16(product_id);
+ device_desc.idVendor = __constant_cpu_to_le16(get_vendor_id(dev));
+ device_desc.idProduct = __constant_cpu_to_le16(get_product_id(dev));
cdev->desc.idProduct = device_desc.idProduct;
return 0;
{
struct android_dev *dev = _android_dev;
int disable = !enable;
- int product_id;
if (!!f->disabled != disable) {
usb_function_set_enabled(f, !disable);
update_dev_desc(dev);
- product_id = get_product_id(dev);
- device_desc.idProduct = __constant_cpu_to_le16(product_id);
+ device_desc.idVendor = __constant_cpu_to_le16(get_vendor_id(dev));
+ device_desc.idProduct = __constant_cpu_to_le16(get_product_id(dev));
if (dev->cdev)
dev->cdev->desc.idProduct = device_desc.idProduct;
usb_composite_force_reset(dev->cdev);
dev->num_products = pdata->num_products;
dev->functions = pdata->functions;
dev->num_functions = pdata->num_functions;
- if (pdata->vendor_id)
+ if (pdata->vendor_id) {
+ dev->vendor_id = pdata->vendor_id;
device_desc.idVendor =
__constant_cpu_to_le16(pdata->vendor_id);
+ }
if (pdata->product_id) {
dev->product_id = pdata->product_id;
device_desc.idProduct =