usb: gadget: slp: fix to use serial number of dmi 22/126022/4
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 19 Apr 2017 01:00:36 +0000 (10:00 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Fri, 23 Jun 2017 04:58:57 +0000 (04:58 +0000)
For identical serial string of slp gadget, this patch fixes to use
product serial of dmi if the dmi value is set.

Change-Id: Ic75f6c7730cba5860afdf3bd60babc754b3ecd67
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
drivers/usb/gadget/legacy/slp.c

index 71246ef48fe842ecfe1f69da384dc55df0241fed..f61ea943961e99053a523d22453db246a76d3aa6 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/module.h>
 #include <linux/fs.h>
 #include <linux/delay.h>
+#include <linux/dmi.h>
 #include <linux/kernel.h>
 #include <linux/utsname.h>
 #include <linux/platform_device.h>
@@ -1166,6 +1167,7 @@ static int slp_multi_bind(struct usb_composite_dev *cdev)
 {
        struct slp_multi_dev *dev = _slp_multi_dev;
        struct usb_gadget       *gadget = cdev->gadget;
+       const char              *serial;
        int                     id, ret;
 
        /*
@@ -1196,7 +1198,12 @@ static int slp_multi_bind(struct usb_composite_dev *cdev)
        /* Default strings - should be updated by userspace */
        strncpy(manufacturer_string, "Samsung", sizeof(manufacturer_string)-1);
        strncpy(product_string, "TIZEN", sizeof(product_string) - 1);
-       snprintf(serial_string, 18, "%s", "01234TEST");
+
+       serial = dmi_get_system_info(DMI_PRODUCT_SERIAL);
+       if (serial)
+               snprintf(serial_string, 18, "%s", serial);
+       else
+               snprintf(serial_string, 18, "%s", "01234TEST");
 
        id = usb_string_id(cdev);
        if (id < 0)