summaryrefslogtreecommitdiff
path: root/src/udev/udev-builtin-usb_id.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev/udev-builtin-usb_id.c')
-rw-r--r--src/udev/udev-builtin-usb_id.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/udev/udev-builtin-usb_id.c b/src/udev/udev-builtin-usb_id.c
index 01e42ca7b1..ee83d4fde9 100644
--- a/src/udev/udev-builtin-usb_id.c
+++ b/src/udev/udev-builtin-usb_id.c
@@ -432,6 +432,17 @@ fallback:
usb_serial = udev_device_get_sysattr_value(dev_usb, "serial");
if (usb_serial) {
+ const unsigned char *p;
+
+ /* http://msdn.microsoft.com/en-us/library/windows/hardware/gg487321.aspx */
+ for (p = (unsigned char *)usb_serial; *p != '\0'; p++)
+ if (*p < 0x20 || *p > 0x7f || *p == ',') {
+ usb_serial = NULL;
+ break;
+ }
+ }
+
+ if (usb_serial) {
util_replace_whitespace(usb_serial, serial_str, sizeof(serial_str)-1);
util_replace_chars(serial_str, NULL);
}