summaryrefslogtreecommitdiff
path: root/extras/usb_id
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-11-20 02:44:08 +0100
committerKay Sievers <kay.sievers@vrfy.org>2008-11-20 02:44:08 +0100
commit5317ca29e531dc32a4cca738e4862bb47230bead (patch)
tree4c4576215370930548dcfbefacd69b9d88498896 /extras/usb_id
parentbbfaec2b2f43ddf7b8ef42a2a687f536ac445183 (diff)
usb_id: replace chars in returned strings
Slashes are not funny in device names: |-- input | |-- by-id | | `-- usb-Logitech_USB-PS | | |-- 2_Optical_Mouse-event-mouse -> ../../event2 | | `-- 2_Optical_Mouse-mouse -> ../../mouse1
Diffstat (limited to 'extras/usb_id')
-rw-r--r--extras/usb_id/usb_id.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c
index 00d8a4c139..91e3ecce4d 100644
--- a/extras/usb_id/usb_id.c
+++ b/extras/usb_id/usb_id.c
@@ -239,6 +239,7 @@ static int usb_id(struct udev_device *dev)
goto fallback;
}
udev_util_replace_whitespace(scsi_vendor, vendor_str, sizeof(vendor_str)-1);
+ udev_util_replace_chars(vendor_str, NULL);
scsi_model = udev_device_get_sysattr_value(dev_scsi, "model");
if (!scsi_model) {
@@ -247,6 +248,7 @@ static int usb_id(struct udev_device *dev)
goto fallback;
}
udev_util_replace_whitespace(scsi_model, model_str, sizeof(model_str)-1);
+ udev_util_replace_chars(model_str, NULL);
scsi_type = udev_device_get_sysattr_value(dev_scsi, "type");
if (!scsi_type) {
@@ -263,6 +265,7 @@ static int usb_id(struct udev_device *dev)
goto fallback;
}
udev_util_replace_whitespace(scsi_rev, revision_str, sizeof(revision_str)-1);
+ udev_util_replace_chars(revision_str, NULL);
/*
* some broken devices have the same identifiers
@@ -287,6 +290,7 @@ fallback:
return 1;
}
udev_util_replace_whitespace(usb_vendor, vendor_str, sizeof(vendor_str)-1);
+ udev_util_replace_chars(vendor_str, NULL);
}
if (model_str[0] == '\0') {
@@ -303,22 +307,27 @@ fallback:
return 1;
}
udev_util_replace_whitespace(usb_model, model_str, sizeof(model_str)-1);
+ udev_util_replace_chars(model_str, NULL);
}
if (revision_str[0] == '\0') {
const char *usb_rev;
usb_rev = udev_device_get_sysattr_value(dev_usb, "bcdDevice");
- if (usb_rev)
+ if (usb_rev) {
udev_util_replace_whitespace(usb_rev, revision_str, sizeof(revision_str)-1);
+ udev_util_replace_chars(revision_str, NULL);
+ }
}
if (serial_str[0] == '\0') {
const char *usb_serial;
usb_serial = udev_device_get_sysattr_value(dev_usb, "serial");
- if (usb_serial)
+ if (usb_serial) {
udev_util_replace_whitespace(usb_serial, serial_str, sizeof(serial_str)-1);
+ udev_util_replace_chars(serial_str, NULL);
+ }
}
return 0;
}