chiark / gitweb /
build-sys: add one more Makefile symlink
[elogind.git] / src / udev / udev-builtin-usb_id.c
index 1b9f8246fb862d1e0f3af060926bc7e4f0821d46..6516d93a3c960e2f24afb4b3df4ec805daf91fd9 100644 (file)
@@ -31,8 +31,7 @@
 
 #include "udev.h"
 
-static void set_usb_iftype(char *to, int if_class_num, size_t len)
-{
+static void set_usb_iftype(char *to, int if_class_num, size_t len) {
         const char *type = "generic";
 
         switch (if_class_num) {
@@ -82,8 +81,7 @@ static void set_usb_iftype(char *to, int if_class_num, size_t len)
         to[len-1] = '\0';
 }
 
-static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len)
-{
+static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len) {
         int type_num = 0;
         char *eptr;
         const char *type = "generic";
@@ -114,8 +112,7 @@ static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len
         return type_num;
 }
 
-static void set_scsi_type(char *to, const char *from, size_t len)
-{
+static void set_scsi_type(char *to, const char *from, size_t len) {
         int type_num;
         char *eptr;
         const char *type = "generic";
@@ -148,8 +145,7 @@ static void set_scsi_type(char *to, const char *from, size_t len)
 #define USB_DT_DEVICE                        0x01
 #define USB_DT_INTERFACE                0x04
 
-static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len)
-{
+static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len) {
         _cleanup_free_ char *filename = NULL;
         _cleanup_close_ int fd = -1;
         ssize_t size;
@@ -157,16 +153,16 @@ static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len
         int pos = 0;
         unsigned strpos = 0;
         struct usb_interface_descriptor {
-                u_int8_t        bLength;
-                u_int8_t        bDescriptorType;
-                u_int8_t        bInterfaceNumber;
-                u_int8_t        bAlternateSetting;
-                u_int8_t        bNumEndpoints;
-                u_int8_t        bInterfaceClass;
-                u_int8_t        bInterfaceSubClass;
-                u_int8_t        bInterfaceProtocol;
-                u_int8_t        iInterface;
-        } __attribute__((packed));
+                uint8_t        bLength;
+                uint8_t        bDescriptorType;
+                uint8_t        bInterfaceNumber;
+                uint8_t        bAlternateSetting;
+                uint8_t        bNumEndpoints;
+                uint8_t        bInterfaceClass;
+                uint8_t        bInterfaceSubClass;
+                uint8_t        bInterfaceProtocol;
+                uint8_t        iInterface;
+        } _packed_;
 
         if (asprintf(&filename, "%s/descriptors", udev_device_get_syspath(dev)) < 0)
                 return log_oom();
@@ -219,9 +215,9 @@ static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len
  * A unique USB identification is generated like this:
  *
  * 1.) Get the USB device type from InterfaceClass and InterfaceSubClass
- * 2.) If the device type is 'Mass-Storage/SPC-2' or 'Mass-Storage/RBC'
+ * 2.) If the device type is 'Mass-Storage/SPC-2' or 'Mass-Storage/RBC',
  *     use the SCSI vendor and model as USB-Vendor and USB-model.
- * 3.) Otherwise use the USB manufacturer and product as
+ * 3.) Otherwise, use the USB manufacturer and product as
  *     USB-Vendor and USB-model. Any non-printable characters
  *     in those strings will be skipped; a slash '/' will be converted
  *     into a full stop '.'.
@@ -232,8 +228,7 @@ static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len
  * 6.) If the device supplies a serial number, this number
  *     is concatenated with the identification with an underscore '_'.
  */
-static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool test)
-{
+static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool test) {
         char vendor_str[64];
         char vendor_str_enc[256];
         const char *vendor_id;
@@ -476,6 +471,6 @@ fallback:
 const struct udev_builtin udev_builtin_usb_id = {
         .name = "usb_id",
         .cmd = builtin_usb_id,
-        .help = "usb device properties",
+        .help = "USB device properties",
         .run_once = true,
 };