*/
#include <linux/kernel.h>
-#include <linux/utsname.h>
#include "u_serial.h"
NULL,
};
-
/* string IDs are assigned dynamically */
-
-static char manufacturer[50];
-
static struct usb_string strings_dev[] = {
- [USB_GADGET_MANUFACTURER_IDX].s = manufacturer,
+ [USB_GADGET_MANUFACTURER_IDX].s = "",
[USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC,
[USB_GADGET_SERIAL_IDX].s = "",
{ } /* end of list */
* 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_ids_tab(cdev, strings_dev);
if (status < 0)
goto fail1;
/* #define VERBOSE_DEBUG */
#include <linux/kernel.h>
-#include <linux/utsname.h>
#include <linux/usb/composite.h>
#include "gadget_chips.h"
/* string IDs are assigned dynamically */
-static char manufacturer[50];
-
static struct usb_string strings_dev[] = {
- [USB_GADGET_MANUFACTURER_IDX].s = manufacturer,
+ [USB_GADGET_MANUFACTURER_IDX].s = "",
[USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC,
[USB_GADGET_SERIAL_IDX].s = "",
{ } /* end of list */
__constant_cpu_to_le16(0x0300 | 0x0099);
}
- /* device descriptor strings: manufacturer, product */
- snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
- init_utsname()->sysname, init_utsname()->release,
- cdev->gadget->name);
status = usb_string_ids_tab(cdev, strings_dev);
if (status < 0)
goto fail;
*/
#include <linux/kernel.h>
-#include <linux/utsname.h>
#include <linux/module.h>
#include "u_ether.h"
/* string IDs are assigned dynamically */
-static char manufacturer[50];
-
static struct usb_string strings_dev[] = {
- [USB_GADGET_MANUFACTURER_IDX].s = manufacturer,
+ [USB_GADGET_MANUFACTURER_IDX].s = "",
[USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC,
[USB_GADGET_SERIAL_IDX].s = "",
{ } /* end of list */
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_ids_tab(cdev, strings_dev);
if (status < 0)
goto fail1;
* with the relevant device-wide data.
*/
-static char composite_manufacturer[50];
-
-/*-------------------------------------------------------------------------*/
/**
* next_ep_desc() - advance to the next EP descriptor
* @t: currect pointer within descriptor array
struct usb_configuration *c;
struct usb_function *f;
int len;
- const char *str;
/* Yes, not only is USB's I18N support probably more than most
* folk will ever care about ... also, it's all supported here.
return s->bLength;
}
- /* Otherwise, look up and return a specified string. First
- * check if the string has not been overridden.
- */
- if (cdev->manufacturer_override == id)
- str = composite_manufacturer;
- else
- str = NULL;
- if (str) {
- struct usb_gadget_strings strings = {
- .language = language,
- .strings = &(struct usb_string) { 0xff, str }
- };
- return usb_gadget_get_string(&strings, 0xff, buf);
- }
-
/* String IDs are device-scoped, so we look up each string
* table we're told about. These lookups are infrequent;
* simpler-is-better here.
usb_ep_free_request(gadget->ep0, cdev->req);
}
device_remove_file(&gadget->dev, &dev_attr_suspended);
+ kfree(cdev->def_manufacturer);
kfree(cdev);
set_gadget_data(gadget, NULL);
}
-static u8 override_id(struct usb_composite_dev *cdev, u8 *desc)
-{
- if (!*desc) {
- int ret = usb_string_id(cdev);
- if (unlikely(ret < 0))
- WARNING(cdev, "failed to override string ID\n");
- else
- *desc = ret;
- }
-
- return *desc;
-}
-
static void update_unchanged_dev_desc(struct usb_device_descriptor *new,
const struct usb_device_descriptor *old)
{
update_unchanged_dev_desc(&cdev->desc, composite->dev);
- /* string overrides */
- if (!cdev->desc.iManufacturer) {
- snprintf(composite_manufacturer,
- sizeof composite_manufacturer,
- "%s %s with %s",
- init_utsname()->sysname,
- init_utsname()->release,
- gadget->name);
-
- cdev->manufacturer_override =
- override_id(cdev, &cdev->desc.iManufacturer);
- }
-
/* has userspace failed to provide a serial number? */
if (composite->needs_serial && !cdev->desc.iSerialNumber)
WARNING(cdev, "userspace failed to provide iSerialNumber\n");
spin_unlock_irqrestore(&cdev->lock, flags);
}
+static char *composite_default_mfr(struct usb_gadget *gadget)
+{
+ char *mfr;
+ int len;
+
+ len = snprintf(NULL, 0, "%s %s with %s", init_utsname()->sysname,
+ init_utsname()->release, gadget->name);
+ len++;
+ mfr = kmalloc(len, GFP_KERNEL);
+ if (!mfr)
+ return NULL;
+ snprintf(mfr, len, "%s %s with %s", init_utsname()->sysname,
+ init_utsname()->release, gadget->name);
+ return mfr;
+}
+
void usb_composite_overwrite_options(struct usb_composite_dev *cdev,
struct usb_composite_overwrite *covr)
{
if (covr->manufacturer) {
desc->iManufacturer = dev_str[USB_GADGET_MANUFACTURER_IDX].id;
dev_str[USB_GADGET_MANUFACTURER_IDX].s = covr->manufacturer;
+
+ } else if (!strlen(dev_str[USB_GADGET_MANUFACTURER_IDX].s)) {
+ desc->iManufacturer = dev_str[USB_GADGET_MANUFACTURER_IDX].id;
+ cdev->def_manufacturer = composite_default_mfr(cdev->gadget);
+ dev_str[USB_GADGET_MANUFACTURER_IDX].s = cdev->def_manufacturer;
}
if (covr->product) {
/* #define VERBOSE_DEBUG */
#include <linux/kernel.h>
-#include <linux/utsname.h>
-
#if defined USB_ETH_RNDIS
# undef USB_ETH_RNDIS
NULL,
};
-/* string IDs are assigned dynamically */
-static char manufacturer[50];
-
static struct usb_string strings_dev[] = {
- [USB_GADGET_MANUFACTURER_IDX].s = manufacturer,
+ [USB_GADGET_MANUFACTURER_IDX].s = "",
[USB_GADGET_PRODUCT_IDX].s = PREFIX DRIVER_DESC,
[USB_GADGET_SERIAL_IDX].s = "",
{ } /* end of list */
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_ids_tab(cdev, strings_dev);
if (status < 0)
goto fail;
*/
#include <linux/kernel.h>
-#include <linux/utsname.h>
#include <linux/module.h>
#include <linux/hid.h>
#include <linux/cdev.h>
#include <linux/spinlock.h>
#include <linux/string.h>
#include <linux/freezer.h>
-#include <linux/utsname.h>
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <linux/kernel.h>
#include <linux/slab.h>
-#include <linux/utsname.h>
#include <linux/device.h>
#include <sound/core.h>
#define pr_fmt(fmt) "g_ffs: " fmt
#include <linux/module.h>
-#include <linux/utsname.h>
/*
* kbuild is not very cooperative with respect to linking separately
#include <linux/kernel.h>
#include <linux/slab.h>
-#include <linux/utsname.h>
#include <linux/module.h>
#include <linux/device.h>
/* string IDs are assigned dynamically */
-static char manufacturer[50];
-
static struct usb_string strings_dev[] = {
- [USB_GADGET_MANUFACTURER_IDX].s = manufacturer,
+ [USB_GADGET_MANUFACTURER_IDX].s = "",
[USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC,
[USB_GADGET_SERIAL_IDX].s = "",
{ } /* end of list */
else
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_ids_tab(cdev, strings_dev);
if (status < 0)
return status;
#include <linux/kernel.h>
-#include <linux/utsname.h>
#include <linux/usb/ch9.h>
-
/*-------------------------------------------------------------------------*/
#define DRIVER_DESC "Mass Storage Gadget"
#include <linux/kernel.h>
-#include <linux/utsname.h>
#include <linux/module.h>
-
#if defined USB_ETH_RNDIS
# undef USB_ETH_RNDIS
#endif
/* #define VERBOSE_DEBUG */
#include <linux/kernel.h>
-#include <linux/utsname.h>
-
#include "u_ether.h"
NULL,
};
-
/* string IDs are assigned dynamically */
-static char manufacturer[50];
-
static struct usb_string strings_dev[] = {
- [USB_GADGET_MANUFACTURER_IDX].s = manufacturer,
+ [USB_GADGET_MANUFACTURER_IDX].s = "",
[USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC,
[USB_GADGET_SERIAL_IDX].s = "",
{ } /* end of list */
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_ids_tab(cdev, strings_dev);
if (status < 0)
goto fail;
*/
#include <linux/kernel.h>
-#include <linux/utsname.h>
#include <linux/device.h>
#include "u_serial.h"
#include <linux/timer.h>
#include <linux/list.h>
#include <linux/interrupt.h>
-#include <linux/utsname.h>
#include <linux/device.h>
#include <linux/moduleparam.h>
#include <linux/fs.h>
/* descriptors that are built on-demand */
-static char manufacturer [50];
static char product_desc [40] = DRIVER_DESC;
static char serial_num [40] = "1";
static char pnp_string [1024] =
/* static strings, in UTF-8 */
static struct usb_string strings [] = {
- [USB_GADGET_MANUFACTURER_IDX].s = manufacturer,
+ [USB_GADGET_MANUFACTURER_IDX].s = "",
[USB_GADGET_PRODUCT_IDX].s = product_desc,
[USB_GADGET_SERIAL_IDX].s = serial_num,
{ } /* end of list */
device_desc.bcdDevice =
cpu_to_le16(0xFFFF);
}
- snprintf(manufacturer, sizeof(manufacturer), "%s %s with %s",
- init_utsname()->sysname, init_utsname()->release,
- gadget->name);
-
if (iPNPstring)
strlcpy(&pnp_string[2], iPNPstring, (sizeof pnp_string)-2);
*/
#include <linux/kernel.h>
-#include <linux/utsname.h>
#include <linux/device.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#define STRING_DESCRIPTION_IDX USB_GADGET_FIRST_AVAIL_IDX
-static char manufacturer[50];
-
static struct usb_string strings_dev[] = {
- [USB_GADGET_MANUFACTURER_IDX].s = manufacturer,
+ [USB_GADGET_MANUFACTURER_IDX].s = "",
[USB_GADGET_PRODUCT_IDX].s = GS_VERSION_NAME,
[USB_GADGET_SERIAL_IDX].s = "",
[STRING_DESCRIPTION_IDX].s = NULL /* updated; f(use_acm) */,
* 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_ids_tab(cdev, strings_dev);
if (status < 0)
goto fail;
#include <linux/kernel.h>
#include <linux/slab.h>
-#include <linux/utsname.h>
#include <linux/device.h>
#include "g_zero.h"
#endif
/* string IDs are assigned dynamically */
-static char manufacturer[50];
-
/* default serial number takes at least two packets */
static char serial[] = "0123456789.0123456789.0123456789";
static struct usb_string strings_dev[] = {
- [USB_GADGET_MANUFACTURER_IDX].s = manufacturer,
+ [USB_GADGET_MANUFACTURER_IDX].s = "",
[USB_GADGET_PRODUCT_IDX].s = longname,
[USB_GADGET_SERIAL_IDX].s = serial,
{ } /* end of list */
INFO(cdev, "%s, version: " DRIVER_VERSION "\n", longname);
- snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
- init_utsname()->sysname, init_utsname()->release,
- gadget->name);
-
return 0;
}
struct list_head configs;
struct usb_composite_driver *driver;
u8 next_string_id;
- u8 manufacturer_override;
+ char *def_manufacturer;
/* the gadget driver won't enable the data pullup
* while the deactivation count is nonzero.