Skip to content

Commit 42bbdf1

Browse files
Merge remote-tracking branch 'libusb/master'
2 parents f385e44 + 23e1cfb commit 42bbdf1

8 files changed

Lines changed: 45 additions & 7 deletions

File tree

.github/workflows/linux.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ jobs:
1818

1919
- name: netlink
2020
# Disable tests for netlink as it doesn't seem to work in the CI environment.
21-
run: .private/ci-build.sh --build-dir build-netlink --no-test -- --disable-udev
21+
run: .private/ci-build.sh --werror --build-dir build-netlink --no-test -- --disable-udev
2222

2323
- name: udev
24-
run: .private/ci-build.sh --build-dir build-udev -- --enable-udev
24+
run: .private/ci-build.sh --werror --build-dir build-udev -- --enable-udev
2525

2626
- name: debug-log
27-
run: .private/ci-build.sh --build-dir build-debug -- --enable-debug-log
27+
run: .private/ci-build.sh --werror --build-dir build-debug -- --enable-debug-log
2828

2929
- name: disable-log
30-
run: .private/ci-build.sh --build-dir build-nolog -- --disable-log
30+
run: .private/ci-build.sh --werror --build-dir build-nolog -- --disable-log
3131

3232
- uses: mymindstorm/setup-emsdk@v13
3333

.private/ci-build.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ while [ $# -gt 0 ]; do
3030
asan=no
3131
shift
3232
;;
33+
--werror)
34+
cflags+=" -Werror"
35+
shift
36+
;;
3337
--)
3438
shift
3539
break;
@@ -53,7 +57,7 @@ fi
5357
mkdir "${builddir}"
5458
cd "${builddir}"
5559

56-
cflags="-O2"
60+
cflags+=" -O2"
5761

5862
# enable extra warnings
5963
cflags+=" -Winline"

libusb/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2310,7 +2310,7 @@ int API_EXPORTED libusb_endpoint_supports_raw_io(libusb_device_handle* dev_handl
23102310
* \returns another LIBUSB_ERROR code on other failure
23112311
*
23122312
* \see libusb_endpoint_supports_raw_io()
2313-
* \seealso https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/winusb-functions-for-pipe-policy-modification
2313+
* \see https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/winusb-functions-for-pipe-policy-modification
23142314
*
23152315
* Since version 1.0.30, \ref LIBUSB_API_VERSION >= 0x0100010C
23162316
*/

libusb/descriptor.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ static void clear_interface(struct libusb_interface *usb_interface)
148148
usb_interface->altsetting + i;
149149

150150
free((void *)ifp->extra);
151+
ifp->extra = NULL;
152+
ifp->extra_length = 0;
151153
if (ifp->endpoint) {
152154
uint8_t j;
153155

@@ -156,10 +158,13 @@ static void clear_interface(struct libusb_interface *usb_interface)
156158
ifp->endpoint + j);
157159
}
158160
free((void *)ifp->endpoint);
161+
ifp->endpoint = NULL;
162+
ifp->bNumEndpoints = 0;
159163
}
160164
}
161165
free((void *)usb_interface->altsetting);
162166
usb_interface->altsetting = NULL;
167+
usb_interface->num_altsetting = 0;
163168
}
164169

165170
static int parse_interface(libusb_context *ctx,
@@ -322,7 +327,11 @@ static void clear_configuration(struct libusb_config_descriptor *config)
322327
config->interface + i);
323328
}
324329
free((void *)config->interface);
330+
config->interface = NULL;
331+
config->bNumInterfaces = 0;
325332
free((void *)config->extra);
333+
config->extra = NULL;
334+
config->extra_length = 0;
326335
}
327336

328337
static int parse_configuration(struct libusb_context *ctx,
@@ -1665,6 +1674,7 @@ int API_EXPORTED libusb_get_device_string(libusb_device *dev,
16651674
}
16661675
if (NULL == data) {
16671676
length = 0;
1677+
data = NULL;
16681678
} else if (length > 0) {
16691679
*data = 0; // return an empty string on errors when possible
16701680
}

libusb/io.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,8 +1370,10 @@ static int arm_timer_for_next_timeout(struct libusb_context *ctx)
13701370

13711371
/* act on first transfer that has not already been handled */
13721372
if (!(itransfer->timeout_flags & (USBI_TRANSFER_TIMEOUT_HANDLED | USBI_TRANSFER_OS_HANDLES_TIMEOUT))) {
1373+
#ifdef ENABLE_LOGGING
13731374
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
13741375
usbi_dbg(ctx, "next timeout originally %ums", transfer->timeout);
1376+
#endif
13751377
return usbi_arm_timer(&ctx->timer, cur_ts);
13761378
}
13771379
}
@@ -1434,9 +1436,11 @@ static int add_to_flying_list(struct usbi_transfer *itransfer)
14341436
if (first && usbi_using_timer(ctx) && TIMESPEC_IS_SET(timeout)) {
14351437
/* if this transfer has the lowest timeout of all active transfers,
14361438
* rearm the timer with this transfer's timeout */
1439+
#ifdef ENABLE_LOGGING
14371440
struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer);
14381441
usbi_dbg(ctx, "arm timer for timeout in %ums (first in line)",
14391442
transfer->timeout);
1443+
#endif
14401444
r = usbi_arm_timer(&ctx->timer, timeout);
14411445
}
14421446
#else

libusb/libusb.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,24 @@ enum libusb_class_code {
262262
/** Personal Healthcare */
263263
LIBUSB_CLASS_PERSONAL_HEALTHCARE = 0x0f,
264264

265+
/** Audio & Video */
266+
LIBUSB_CLASS_AUDIO_VIDEO = 0x10,
267+
268+
/** Billboard */
269+
LIBUSB_CLASS_BILLBOARD = 0x11,
270+
271+
/** Interface class */
272+
LIBUSB_CLASS_TYPE_C_BRIDGE = 0x12,
273+
274+
/** Bulk display */
275+
LIBUSB_CLASS_BULK_DISPLAY_PROTOCOL = 0x13,
276+
277+
/** MCTP */
278+
LIBUSB_CLASS_MCTP = 0x14,
279+
280+
/** I3C */
281+
LIBUSB_CLASS_I3C = 0x3c,
282+
265283
/** Diagnostic Device */
266284
LIBUSB_CLASS_DIAGNOSTIC_DEVICE = 0xdc,
267285

libusb/os/linux_usbfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,8 @@ static int op_get_device_string(struct libusb_device *dev,
473473
case LIBUSB_DEVICE_STRING_MANUFACTURER: attr = "manufacturer"; break;
474474
case LIBUSB_DEVICE_STRING_PRODUCT: attr = "product"; break;
475475
case LIBUSB_DEVICE_STRING_SERIAL_NUMBER: attr = "serial"; break;
476+
case LIBUSB_DEVICE_STRING_COUNT:
477+
/* intentional fall-through, avoid -Wswitch-enum */
476478
default:
477479
return LIBUSB_ERROR_INVALID_PARAM;
478480
}

libusb/version_nano.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
#define LIBUSB_NANO 11995
1+
#define LIBUSB_NANO 12002

0 commit comments

Comments
 (0)