lsusb: make internal API const-aware

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
This commit is contained in:
Emil Velikov 2024-09-19 22:52:22 +01:00
parent dd97b758be
commit 1a1185f914
3 changed files with 7 additions and 8 deletions

11
lsusb.c
View File

@ -151,7 +151,7 @@ static void dump_midistreaming_interface(libusb_device_handle *dev, const unsign
static void dump_videocontrol_interface(libusb_device_handle *dev, const unsigned char *buf, int protocol);
static void dump_videostreaming_interface(const unsigned char *buf);
static void dump_dfu_interface(const unsigned char *buf);
static char *dump_comm_descriptor(libusb_device_handle *dev, const unsigned char *buf, char *indent);
static void dump_comm_descriptor(libusb_device_handle *dev, const unsigned char *buf, const char *indent);
static void dump_hid_device(libusb_device_handle *dev, const struct libusb_interface_descriptor *interface, const unsigned char *buf);
static void dump_printer_device(libusb_device_handle *dev, const struct libusb_interface_descriptor *interface, const unsigned char *buf);
static void dump_audiostreaming_endpoint(libusb_device_handle *dev, const unsigned char *buf, int protocol);
@ -2538,8 +2538,8 @@ static void dump_hid_device(libusb_device_handle *dev,
}
}
static char *
dump_comm_descriptor(libusb_device_handle *dev, const unsigned char *buf, char *indent)
static void
dump_comm_descriptor(libusb_device_handle *dev, const unsigned char *buf, const char *indent)
{
int tmp;
char *str = NULL;
@ -2818,17 +2818,16 @@ dump_comm_descriptor(libusb_device_handle *dev, const unsigned char *buf, char *
/* FIXME there are about a dozen more descriptor types */
printf("%sUNRECOGNIZED CDC: ", indent);
dump_bytes(buf, buf[0]);
return "unrecognized comm descriptor";
return;
}
free(str);
return 0;
return;
bad:
printf("%sINVALID CDC (%s): ", indent, type);
dump_bytes(buf, buf[0]);
return "corrupt comm descriptor";
}
/* ---------------------------------------------------------------------- */

View File

@ -50,7 +50,7 @@ int get_sysfs_name(char *buf, size_t size, libusb_device *dev)
return len;
}
int read_sysfs_prop(char *buf, size_t size, char *sysfs_name, char *propname)
int read_sysfs_prop(char *buf, size_t size, const char *sysfs_name, const char *propname)
{
int n, fd;
char path[PATH_MAX];

View File

@ -10,7 +10,7 @@
/* ---------------------------------------------------------------------- */
int get_sysfs_name(char *buf, size_t size, libusb_device *dev);
extern int read_sysfs_prop(char *buf, size_t size, char *sysfs_name, char *propname);
extern int read_sysfs_prop(char *buf, size_t size, const char *sysfs_name, const char *propname);
/* ---------------------------------------------------------------------- */
#endif /* _SYSFS_H */