hidapi, linux: merged a minor warning + code style fix from mainstream.

This commit is contained in:
Ozkan Sezer 2021-11-17 10:00:10 +03:00
parent 43d1b42a5a
commit d2cf191936
1 changed files with 30 additions and 25 deletions

View File

@ -215,7 +215,7 @@ static int uses_numbered_reports(__u8 *report_descriptor, __u32 size) {
* strings pointed to by serial_number_utf8 and product_name_utf8 after use. * strings pointed to by serial_number_utf8 and product_name_utf8 after use.
*/ */
static int static int
parse_uevent_info(const char *uevent, int *bus_type, parse_uevent_info(const char *uevent, unsigned *bus_type,
unsigned short *vendor_id, unsigned short *product_id, unsigned short *vendor_id, unsigned short *product_id,
char **serial_number_utf8, char **product_name_utf8) char **serial_number_utf8, char **product_name_utf8)
{ {
@ -298,7 +298,7 @@ static int is_BLE(hid_device *dev)
if (hid_dev) { if (hid_dev) {
unsigned short dev_vid = 0; unsigned short dev_vid = 0;
unsigned short dev_pid = 0; unsigned short dev_pid = 0;
int bus_type = 0; unsigned bus_type = 0;
char *serial_number_utf8 = NULL; char *serial_number_utf8 = NULL;
char *product_name_utf8 = NULL; char *product_name_utf8 = NULL;
@ -363,7 +363,7 @@ static int get_device_string(hid_device *dev, enum device_string_id key, wchar_t
if (hid_dev) { if (hid_dev) {
unsigned short dev_vid; unsigned short dev_vid;
unsigned short dev_pid; unsigned short dev_pid;
int bus_type; unsigned bus_type;
size_t retm; size_t retm;
ret = parse_uevent_info( ret = parse_uevent_info(
@ -501,7 +501,7 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,
unsigned short dev_pid; unsigned short dev_pid;
char *serial_number_utf8 = NULL; char *serial_number_utf8 = NULL;
char *product_name_utf8 = NULL; char *product_name_utf8 = NULL;
int bus_type; unsigned bus_type;
int result; int result;
/* Get the filename of the /sys entry for the device /* Get the filename of the /sys entry for the device
@ -855,7 +855,8 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data,
if (res < 0) if (res < 0)
perror("ioctl (GFEATURE)"); perror("ioctl (GFEATURE)");
else if (dev->needs_ble_hack) { else if (dev->needs_ble_hack) {
/* Versions of BlueZ before 5.56 don't include the report in the data, and versions of BlueZ >= 5.56 include 2 copies of the report. /* Versions of BlueZ before 5.56 don't include the report in the data,
* and versions of BlueZ >= 5.56 include 2 copies of the report.
* We'll fix it so that there is a single copy of the report in both cases * We'll fix it so that there is a single copy of the report in both cases
*/ */
if (data[0] == report && data[1] == report) { if (data[0] == report && data[1] == report) {
@ -896,6 +897,10 @@ int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *s
int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen) int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen)
{ {
(void)dev;
(void)string_index;
(void)string;
(void)maxlen;
return -1; return -1;
} }