static int __exit maemo_unbind(struct usb_composite_dev *cdev) { gserial_cleanup(); gether_cleanup(); diag_cleanup(diag_ch); return 0; }
static int __exit nokia_unbind(struct usb_composite_dev *cdev) { gphonet_cleanup(); gserial_cleanup(); gether_cleanup(); return 0; }
static int __exit nokia_unbind(struct usb_composite_dev *cdev) { gphonet_cleanup(); gserial_cleanup(); gether_cleanup(); // usb_gadget_disconnect(cdev->gadget); // return 0; }
static int __init cdc_bind(struct usb_composite_dev *cdev) { struct usb_gadget *gadget = cdev->gadget; int status; if (!can_support_ecm(cdev->gadget)) { dev_err(&gadget->dev, "controller '%s' not usable\n", gadget->name); return -EINVAL; } /* set up network link layer */ status = gether_setup(cdev->gadget, hostaddr); if (status < 0) return status; /* set up serial link layer */ status = gserial_setup(cdev->gadget, 1); if (status < 0) goto fail0; /* Allocate string descriptor numbers ... note that string * contents can be overridden by the composite_dev glue. */ status = usb_string_ids_tab(cdev, strings_dev); if (status < 0) goto fail1; device_desc.iManufacturer = strings_dev[USB_GADGET_MANUFACTURER_IDX].id; device_desc.iProduct = strings_dev[USB_GADGET_PRODUCT_IDX].id; /* register our configuration */ status = usb_add_config(cdev, &cdc_config_driver, cdc_do_config); if (status < 0) goto fail1; usb_composite_overwrite_options(cdev, &coverwrite); dev_info(&gadget->dev, "%s, version: " DRIVER_VERSION "\n", DRIVER_DESC); return 0; fail1: gserial_cleanup(); fail0: gether_cleanup(); return status; }
static int __init nokia_bind(struct usb_composite_dev *cdev) { int gcnum; struct usb_gadget *gadget = cdev->gadget; int status; status = gphonet_setup(cdev->gadget); if (status < 0) goto err_phonet; status = gserial_setup(cdev->gadget, 3); if (status < 0) goto err_serial; status = gether_setup(cdev->gadget, hostaddr); if (status < 0) goto err_ether; status = usb_string_id(cdev); if (status < 0) goto err_usb; strings_dev[STRING_MANUFACTURER_IDX].id = status; device_desc.iManufacturer = status; status = usb_string_id(cdev); if (status < 0) goto err_usb; strings_dev[STRING_PRODUCT_IDX].id = status; device_desc.iProduct = status; /* config description */ status = usb_string_id(cdev); if (status < 0) goto err_usb; strings_dev[STRING_DESCRIPTION_IDX].id = status; nokia_config_500ma_driver.iConfiguration = status; nokia_config_100ma_driver.iConfiguration = status; /* set up other descriptors */ gcnum = usb_gadget_controller_number(gadget); if (gcnum >= 0) device_desc.bcdDevice = cpu_to_le16(NOKIA_VERSION_NUM); else { /* this should only work with hw that supports altsettings * and several endpoints, anything else, panic. */ pr_err("nokia_bind: controller '%s' not recognized\n", gadget->name); goto err_usb; } /* finaly register the configuration */ status = usb_add_config(cdev, &nokia_config_500ma_driver, nokia_bind_config); if (status < 0) goto err_usb; status = usb_add_config(cdev, &nokia_config_100ma_driver, nokia_bind_config); if (status < 0) goto err_usb; dev_info(&gadget->dev, "%s\n", NOKIA_LONG_NAME); return 0; err_usb: gether_cleanup(); err_ether: gserial_cleanup(); err_serial: gphonet_cleanup(); err_phonet: return status; }
static int __ref multi_bind(struct usb_composite_dev *cdev) { struct usb_gadget *gadget = cdev->gadget; int status, gcnum; if (!can_support_ecm(cdev->gadget)) { dev_err(&gadget->dev, "controller '%s' not usable\n", gadget->name); return -EINVAL; } /* set up network link layer */ status = gether_setup(cdev->gadget, hostaddr); if (status < 0) return status; /* set up serial link layer */ status = gserial_setup(cdev->gadget, 1); if (status < 0) goto fail0; /* set up mass storage function */ { void *retp; retp = fsg_common_from_params(&fsg_common, cdev, &fsg_mod_data); if (IS_ERR(retp)) { status = PTR_ERR(retp); goto fail1; } } /* set bcdDevice */ gcnum = usb_gadget_controller_number(gadget); if (gcnum >= 0) { device_desc.bcdDevice = cpu_to_le16(0x0300 | gcnum); } else { WARNING(cdev, "controller '%s' not recognized\n", gadget->name); device_desc.bcdDevice = cpu_to_le16(0x0300 | 0x0099); } /* allocate string descriptor numbers */ snprintf(manufacturer, sizeof manufacturer, "%s %s with %s", init_utsname()->sysname, init_utsname()->release, gadget->name); status = usb_string_ids_tab(cdev, strings_dev); if (unlikely(status < 0)) goto fail2; device_desc.iManufacturer = strings_dev[MULTI_STRING_MANUFACTURER_IDX].id; device_desc.iProduct = strings_dev[MULTI_STRING_PRODUCT_IDX].id; /* register configurations */ status = rndis_config_register(cdev); if (unlikely(status < 0)) goto fail2; status = cdc_config_register(cdev); if (unlikely(status < 0)) goto fail2; /* we're done */ dev_info(&gadget->dev, DRIVER_DESC "\n"); fsg_common_put(&fsg_common); return 0; /* error recovery */ fail2: fsg_common_put(&fsg_common); fail1: gserial_cleanup(); fail0: gether_cleanup(); return status; }
static void __exit cleanup(void) { usb_composite_unregister(&gserial_driver); gserial_cleanup(); }
static int __init gs_bind(struct usb_composite_dev *cdev) { int gcnum; struct usb_gadget *gadget = cdev->gadget; int status; status = gserial_setup(cdev->gadget, n_ports); if (status < 0) return status; /* Allocate string descriptor numbers ... note that string * contents can be overridden by the composite_dev glue. */ /* device description: manufacturer, product */ snprintf(manufacturer, sizeof manufacturer, "%s %s with %s", init_utsname()->sysname, init_utsname()->release, gadget->name); status = usb_string_id(cdev); if (status < 0) goto fail; strings_dev[STRING_MANUFACTURER_IDX].id = status; device_desc.iManufacturer = status; status = usb_string_id(cdev); if (status < 0) goto fail; strings_dev[STRING_PRODUCT_IDX].id = status; device_desc.iProduct = status; /* config description */ status = usb_string_id(cdev); if (status < 0) goto fail; strings_dev[STRING_DESCRIPTION_IDX].id = status; serial_config_driver.iConfiguration = status; /* set up other descriptors */ gcnum = usb_gadget_controller_number(gadget); if (gcnum >= 0) device_desc.bcdDevice = cpu_to_le16(GS_VERSION_NUM | gcnum); else { /* this is so simple (for now, no altsettings) that it * SHOULD NOT have problems with bulk-capable hardware. * so warn about unrcognized controllers -- don't panic. * * things like configuration and altsetting numbering * can need hardware-specific attention though. */ pr_warning("gs_bind: controller '%s' not recognized\n", gadget->name); device_desc.bcdDevice = __constant_cpu_to_le16(GS_VERSION_NUM | 0x0099); } if (gadget_is_otg(cdev->gadget)) { serial_config_driver.descriptors = otg_desc; serial_config_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP; } /* register our configuration */ status = usb_add_config(cdev, &serial_config_driver); if (status < 0) goto fail; INFO(cdev, "%s\n", GS_VERSION_NAME); return 0; fail: gserial_cleanup(); return status; }
static int __init gs_bind(struct usb_composite_dev *cdev) { int gcnum; struct usb_gadget *gadget = cdev->gadget; int status; status = gserial_setup(cdev->gadget, n_ports); if (status < 0) return status; snprintf(manufacturer, sizeof manufacturer, "%s %s with %s", init_utsname()->sysname, init_utsname()->release, gadget->name); status = usb_string_id(cdev); if (status < 0) goto fail; strings_dev[STRING_MANUFACTURER_IDX].id = status; device_desc.iManufacturer = status; status = usb_string_id(cdev); if (status < 0) goto fail; strings_dev[STRING_PRODUCT_IDX].id = status; device_desc.iProduct = status; status = usb_string_id(cdev); if (status < 0) goto fail; strings_dev[STRING_DESCRIPTION_IDX].id = status; serial_config_driver.iConfiguration = status; gcnum = usb_gadget_controller_number(gadget); if (gcnum >= 0) device_desc.bcdDevice = cpu_to_le16(GS_VERSION_NUM | gcnum); else { pr_warning("gs_bind: controller '%s' not recognized\n", gadget->name); device_desc.bcdDevice = cpu_to_le16(GS_VERSION_NUM | 0x0099); } if (gadget_is_otg(cdev->gadget)) { serial_config_driver.descriptors = otg_desc; serial_config_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP; } status = usb_add_config(cdev, &serial_config_driver); if (status < 0) goto fail; INFO(cdev, "%s\n", GS_VERSION_NAME); return 0; fail: gserial_cleanup(); return status; }
static int fserial_remove(struct platform_device *dev) { gserial_cleanup(); return 0; }
static int maemo_bind(struct usb_composite_dev *cdev) { struct usb_gadget *gadget = cdev->gadget; int status, gcnum; /* set up diag channel */ diag_ch = diag_setup(&usb_diag_pdata); if (IS_ERR(diag_ch)) return PTR_ERR(diag_ch); /* set up network link layer */ status = gether_setup(cdev->gadget, hostaddr); if (status < 0) goto diag_clean; /* set up serial link layer */ status = gserial_setup(cdev->gadget, 2); if (status < 0) goto fail0; /* set up mass storage function */ fsg_common = fsg_common_from_params(0, cdev, &mod_data); if (IS_ERR(fsg_common)) { status = PTR_ERR(fsg_common); goto fail1; } gcnum = usb_gadget_controller_number(gadget); if (gcnum >= 0) device_desc.bcdDevice = cpu_to_le16(0x0300 | gcnum); else { /* gadget zero is so simple (for now, no altsettings) that * it SHOULD NOT have problems with bulk-capable hardware. * so just warn about unrcognized controllers -- don't panic. * * things like configuration and altsetting numbering * can need hardware-specific attention though. */ WARNING(cdev, "controller '%s' not recognized\n", gadget->name); device_desc.bcdDevice = __constant_cpu_to_le16(0x9999); } /* Allocate string descriptor numbers ... note that string * contents can be overridden by the composite_dev glue. */ status = usb_string_id(cdev); if (status < 0) goto fail2; strings_dev[STRING_MANUFACTURER_IDX].id = status; device_desc.iManufacturer = status; status = usb_string_id(cdev); if (status < 0) goto fail2; strings_dev[STRING_PRODUCT_IDX].id = status; device_desc.iProduct = status; if (!usb_gadget_set_selfpowered(gadget)) maemo_config_driver.bmAttributes |= USB_CONFIG_ATT_SELFPOWER; if (gadget->ops->wakeup) maemo_config_driver.bmAttributes |= USB_CONFIG_ATT_WAKEUP; /* register our first configuration */ status = usb_add_config(cdev, &maemo_config_driver); if (status < 0) goto fail2; usb_gadget_set_selfpowered(gadget); dev_info(&gadget->dev, DRIVER_DESC "\n"); fsg_common_put(fsg_common); return 0; fail2: fsg_common_put(fsg_common); fail1: gserial_cleanup(); fail0: gether_cleanup(); diag_clean: diag_cleanup(diag_ch); return status; }
static int __exit acm_ms_unbind(struct usb_composite_dev *cdev) { gserial_cleanup(); return 0; }
static int __init acm_ms_bind(struct usb_composite_dev *cdev) { int gcnum; struct usb_gadget *gadget = cdev->gadget; int status; void *retp; status = gserial_setup(cdev->gadget, 1); if (status < 0) return status; retp = fsg_common_from_params(&fsg_common, cdev, &fsg_mod_data); if (IS_ERR(retp)) { status = PTR_ERR(retp); goto fail0; } gcnum = usb_gadget_controller_number(gadget); if (gcnum >= 0) { device_desc.bcdDevice = cpu_to_le16(0x0300 | gcnum); } else { WARNING(cdev, "controller '%s' not recognized; trying %s\n", gadget->name, acm_ms_config_driver.label); device_desc.bcdDevice = cpu_to_le16(0x0300 | 0x0099); } snprintf(manufacturer, sizeof manufacturer, "%s %s with %s", init_utsname()->sysname, init_utsname()->release, gadget->name); status = usb_string_id(cdev); if (status < 0) goto fail1; strings_dev[STRING_MANUFACTURER_IDX].id = status; device_desc.iManufacturer = status; status = usb_string_id(cdev); if (status < 0) goto fail1; strings_dev[STRING_PRODUCT_IDX].id = status; device_desc.iProduct = status; status = usb_add_config(cdev, &acm_ms_config_driver, acm_ms_do_config); if (status < 0) goto fail1; dev_info(&gadget->dev, "%s, version: " DRIVER_VERSION "\n", DRIVER_DESC); fsg_common_put(&fsg_common); return 0; fail1: fsg_common_put(&fsg_common); fail0: gserial_cleanup(); return status; }
static int __init multi_bind(struct usb_composite_dev *cdev) { struct usb_gadget *gadget = cdev->gadget; int status, gcnum; if (!can_support_ecm(cdev->gadget)) { dev_err(&gadget->dev, "controller '%s' not usable\n", gadget->name); return -EINVAL; } /* set up network link layer */ status = gether_setup(cdev->gadget, hostaddr); if (status < 0) return status; /* set up serial link layer */ status = gserial_setup(cdev->gadget, 1); if (status < 0) goto fail0; /* set up mass storage function */ fsg_common = fsg_common_from_params(0, cdev, &mod_data); if (IS_ERR(fsg_common)) { status = PTR_ERR(fsg_common); goto fail1; } gcnum = usb_gadget_controller_number(gadget); if (gcnum >= 0) device_desc.bcdDevice = cpu_to_le16(0x0300 | gcnum); else { /* We assume that can_support_ecm() tells the truth; * but if the controller isn't recognized at all then * that assumption is a bit more likely to be wrong. */ // WARNING(cdev, "controller '%s' not recognized\n", // gadget->name); device_desc.bcdDevice = cpu_to_le16(0x0300 | 0x0099); } /* Allocate string descriptor numbers ... note that string * contents can be overridden by the composite_dev glue. */ /* device descriptor strings: manufacturer, product */ snprintf(manufacturer, sizeof manufacturer, "%s %s with %s", init_utsname()->sysname, init_utsname()->release, gadget->name); status = usb_string_id(cdev); if (status < 0) goto fail2; strings_dev[STRING_MANUFACTURER_IDX].id = status; device_desc.iManufacturer = status; status = usb_string_id(cdev); if (status < 0) goto fail2; strings_dev[STRING_PRODUCT_IDX].id = status; device_desc.iProduct = status; status = usb_string_id(cdev); if (status < 0) goto fail2; strings_dev[STRING_SERIAL_IDX].id = status; device_desc.iSerialNumber = status; #ifdef USB_ETH_RNDIS /* register our first configuration */ status = usb_add_config(cdev, &rndis_config_driver); if (status < 0) goto fail2; #endif #ifdef CONFIG_USB_G_MULTI_CDC /* register our second configuration */ status = usb_add_config(cdev, &cdc_config_driver); if (status < 0) goto fail2; #endif dev_info(&gadget->dev, DRIVER_DESC ", version: " DRIVER_VERSION "\n"); fsg_common_put(fsg_common); return 0; fail2: fsg_common_put(fsg_common); fail1: gserial_cleanup(); fail0: gether_cleanup(); return status; }
static int cdc_bind(struct usb_composite_dev *cdev) { int gcnum; struct usb_gadget *gadget = cdev->gadget; int status; if (!can_support_ecm(cdev->gadget)) { dev_err(&gadget->dev, "controller '%s' not usable\n", gadget->name); return -EINVAL; } /* set up network link layer */ status = gether_setup(cdev->gadget, hostaddr); if (status < 0) return status; /* set up serial link layer */ status = gserial_setup(cdev->gadget, 1); if (status < 0) goto fail0; gcnum = usb_gadget_controller_number(gadget); if (gcnum >= 0) device_desc.bcdDevice = cpu_to_le16(0x0300 | gcnum); else { /* We assume that can_support_ecm() tells the truth; * but if the controller isn't recognized at all then * that assumption is a bit more likely to be wrong. */ WARNING(cdev, "controller '%s' not recognized; trying %s\n", gadget->name, cdc_config_driver.label); device_desc.bcdDevice = cpu_to_le16(0x0300 | 0x0099); } /* Allocate string descriptor numbers ... note that string * contents can be overridden by the composite_dev glue. */ /* device descriptor strings: manufacturer, product */ snprintf(manufacturer, sizeof manufacturer, "%s %s with %s", init_utsname()->sysname, init_utsname()->release, gadget->name); status = usb_string_id(cdev); if (status < 0) goto fail1; strings_dev[STRING_MANUFACTURER_IDX].id = status; device_desc.iManufacturer = status; status = usb_string_id(cdev); if (status < 0) goto fail1; strings_dev[STRING_PRODUCT_IDX].id = status; device_desc.iProduct = status; /* register our configuration */ status = usb_add_config(cdev, &cdc_config_driver); if (status < 0) goto fail1; dev_info(&gadget->dev, "%s, version: " DRIVER_VERSION "\n", DRIVER_DESC); return 0; fail1: gserial_cleanup(); fail0: gether_cleanup(); return status; }
static int __exit multi_unbind(struct usb_composite_dev *cdev) { gserial_cleanup(); gether_cleanup(); return 0; }
static void lge_normal_unbind(struct usb_configuration *c) { printk(KERN_INFO "%s\n", __func__); personality_cdev_to_device_desc(c->cdev)->bDeviceClass = 0; gserial_cleanup(); }