Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 213545
b: refs/heads/master
c: 7c2b61d
h: refs/heads/master
i:
  213543: 55be852
v: v3
  • Loading branch information
Michal Nazarewicz authored and Greg Kroah-Hartman committed Oct 22, 2010
1 parent adfb693 commit a2ee9dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 67 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ad1a8102f957f4d25fc58cdc10736c5ade7557e1
refs/heads/master: 7c2b61d02c384a0d5867e524ae72ad98ec2d33fd
72 changes: 6 additions & 66 deletions trunk/drivers/usb/gadget/mass_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,15 @@ static struct usb_device_descriptor msg_device_desc = {
/* Vendor and product id can be overridden by module parameters. */
.idVendor = cpu_to_le16(FSG_VENDOR_ID),
.idProduct = cpu_to_le16(FSG_PRODUCT_ID),
/* .bcdDevice = f(hardware) */
/* .iManufacturer = DYNAMIC */
/* .iProduct = DYNAMIC */
/* NO SERIAL NUMBER */
.bNumConfigurations = 1,
};

static struct usb_otg_descriptor otg_descriptor = {
.bLength = sizeof otg_descriptor,
.bDescriptorType = USB_DT_OTG,

/* REVISIT SRP-only hardware is possible, although
/*
* REVISIT SRP-only hardware is possible, although
* it would not be called "OTG" ...
*/
.bmAttributes = USB_OTG_SRP | USB_OTG_HNP,
Expand All @@ -98,33 +95,6 @@ static const struct usb_descriptor_header *otg_desc[] = {
};


/* string IDs are assigned dynamically */

#define STRING_MANUFACTURER_IDX 0
#define STRING_PRODUCT_IDX 1
#define STRING_CONFIGURATION_IDX 2

static char manufacturer[50];

static struct usb_string strings_dev[] = {
[STRING_MANUFACTURER_IDX].s = manufacturer,
[STRING_PRODUCT_IDX].s = DRIVER_DESC,
[STRING_CONFIGURATION_IDX].s = "Self Powered",
{ } /* end of list */
};

static struct usb_gadget_strings stringtab_dev = {
.language = 0x0409, /* en-us */
.strings = strings_dev,
};

static struct usb_gadget_strings *dev_strings[] = {
&stringtab_dev,
NULL,
};



/****************************** Configurations ******************************/

static struct fsg_module_parameters mod_data = {
Expand Down Expand Up @@ -173,65 +143,35 @@ static struct usb_configuration msg_config_driver = {
.label = "Linux File-Backed Storage",
.bind = msg_do_config,
.bConfigurationValue = 1,
/* .iConfiguration = DYNAMIC */
.bmAttributes = USB_CONFIG_ATT_SELFPOWER,
};



/****************************** Gadget Bind ******************************/


static int __ref msg_bind(struct usb_composite_dev *cdev)
{
struct usb_gadget *gadget = cdev->gadget;
int status;

/* 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)
return status;
strings_dev[STRING_MANUFACTURER_IDX].id = status;
msg_device_desc.iManufacturer = status;

status = usb_string_id(cdev);
if (status < 0)
return status;
strings_dev[STRING_PRODUCT_IDX].id = status;
msg_device_desc.iProduct = status;

status = usb_string_id(cdev);
if (status < 0)
return status;
strings_dev[STRING_CONFIGURATION_IDX].id = status;
msg_config_driver.iConfiguration = status;

/* register our second configuration */
status = usb_add_config(cdev, &msg_config_driver);
if (status < 0)
return status;

dev_info(&gadget->dev, DRIVER_DESC ", version: " DRIVER_VERSION "\n");
dev_info(&cdev->gadget->dev,
DRIVER_DESC ", version: " DRIVER_VERSION "\n");
set_bit(0, &msg_registered);
return 0;
}


/****************************** Some noise ******************************/


static struct usb_composite_driver msg_driver = {
.name = "g_mass_storage",
.dev = &msg_device_desc,
.strings = dev_strings,
.bind = msg_bind,
.iProduct = DRIVER_DESC,
.needs_serial = 1,
};

MODULE_DESCRIPTION(DRIVER_DESC);
Expand Down

0 comments on commit a2ee9dc

Please sign in to comment.