Skip to content

Commit 52eccd1

Browse files
Merge remote-tracking branch 'libusb/master'
2 parents 5610521 + c4742e5 commit 52eccd1

8 files changed

Lines changed: 46 additions & 35 deletions

File tree

AUTHORS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Aaron Luft
1515
Adam Korcz
1616
Addison Crump
1717
Adrian Bunk
18+
Adrien Bertrand
1819
Adrien Destugues
1920
Akshay Jaggi
2021
Alan Ott
@@ -84,8 +85,10 @@ Graeme Gill
8485
Greg Kroah-Hartman
8586
Gustavo Zacarias
8687
Haidong Zheng
88+
Hannes Franke
8789
Hans Ulrich Niedermann
8890
Harry Mallon
91+
Hartwig Wiesmann
8992
Hector Martin
9093
Hoi-Ho Chan
9194
Ido Yariv
@@ -124,9 +127,11 @@ Lars Wirzenius
124127
Lei Chen
125128
Léo Lam
126129
Liang Yunwang
130+
Logan Gallois
127131
Lonnie Abelbeck
128132
Luca Longinotti
129133
Luz Paz
134+
Łukasz Bartosik
130135
Mac Wang
131136
Marco Trevisan (Treviño)
132137
Marcus Meissner
@@ -138,6 +143,7 @@ Martin Koegler
138143
Martin Ling
139144
Martin Thierer
140145
Mathias Hjärtström
146+
Matt Liberty
141147
Matthew Stapleton
142148
Matthias Bolte
143149
Matthijs Lavrijsen
@@ -152,6 +158,7 @@ Nancy Li
152158
Nia Alarie
153159
Nicholas Corgan
154160
Niklas Gürtler
161+
Ole André Vadla Ravnås
155162
Oleksand Radovenchyk
156163
Omri Iluz
157164
Orhan aib Kavrakoglu
@@ -191,6 +198,7 @@ Steinar H. Gunderson
191198
Stephen Groat
192199
Sylvain Fasel
193200
Theo Buehler
201+
Theodor Engøy
194202
Thomas Röfer
195203
Tim Hutt
196204
Tim Roberts
@@ -200,6 +208,7 @@ Tormod Volden
200208
Trygve Laugstøl
201209
Uri Lublin
202210
Uwe Bonnes
211+
Vadim Mikhailov
203212
Vasily Khoruzhick
204213
Vegard Storheil Eriksen
205214
Venkatesh Shukla
@@ -208,6 +217,7 @@ Victor Toso
208217
Vinicius Tinti
209218
Vitali Lovich
210219
Vladimir Beloborodov
220+
Vladimir Gladkov
211221
William Orr
212222
William Skellenger
213223
Xiaofan Chen

ChangeLog

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
For detailed information about the changes below, please see the git log.
22

3-
202?-??-??: v1.0.30
3+
2026-02-22: v1.0.30-rc1
44
* Add hotplug support on Microsoft Windows
55
* Add RAW_IO support in WinUSB backend
66
* Work around a macOS 26 Tahoe compatibility breakage due to Apple changing kUSBHostPortPropertyPortNumber

libusb/libusb-1.0.def

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ EXPORTS
2525
libusb_dev_mem_free
2626
libusb_dev_mem_free@12 = libusb_dev_mem_free
2727
libusb_endpoint_set_raw_io
28+
libusb_endpoint_set_raw_io@12 = libusb_endpoint_set_raw_io
2829
libusb_endpoint_supports_raw_io
30+
libusb_endpoint_supports_raw_io@8 = libusb_endpoint_supports_raw_io
2931
libusb_error_name
3032
libusb_error_name@4 = libusb_error_name
3133
libusb_event_handler_active
@@ -66,8 +68,6 @@ EXPORTS
6668
libusb_get_active_interface_association_descriptors@8 = libusb_get_active_interface_association_descriptors
6769
libusb_get_bos_descriptor
6870
libusb_get_bos_descriptor@8 = libusb_get_bos_descriptor
69-
libusb_get_session_data
70-
libusb_get_session_data@4 = libusb_get_session_data
7171
libusb_get_bus_number
7272
libusb_get_bus_number@4 = libusb_get_bus_number
7373
libusb_get_config_descriptor
@@ -96,9 +96,10 @@ EXPORTS
9696
libusb_get_max_alt_packet_size@16 = libusb_get_max_alt_packet_size
9797
libusb_get_max_iso_packet_size
9898
libusb_get_max_iso_packet_size@8 = libusb_get_max_iso_packet_size
99-
libusb_get_max_raw_io_transfer_size
10099
libusb_get_max_packet_size
101100
libusb_get_max_packet_size@8 = libusb_get_max_packet_size
101+
libusb_get_max_raw_io_transfer_size
102+
libusb_get_max_raw_io_transfer_size@8 = libusb_get_max_raw_io_transfer_size
102103
libusb_get_next_timeout
103104
libusb_get_next_timeout@8 = libusb_get_next_timeout
104105
libusb_get_parent
@@ -113,6 +114,8 @@ EXPORTS
113114
libusb_get_port_numbers@12 = libusb_get_port_numbers
114115
libusb_get_port_path
115116
libusb_get_port_path@16 = libusb_get_port_path
117+
libusb_get_session_data
118+
libusb_get_session_data@4 = libusb_get_session_data
116119
libusb_get_ss_endpoint_companion_descriptor
117120
libusb_get_ss_endpoint_companion_descriptor@12 = libusb_get_ss_endpoint_companion_descriptor
118121
libusb_get_ss_usb_device_capability_descriptor

libusb/os/darwin_usb.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,9 +1027,9 @@ static int get_configuration_index (struct libusb_device *dev, UInt8 config_valu
10271027
return darwin_to_libusb (kresult);
10281028

10291029
for (i = 0 ; i < numConfig ; i++) {
1030-
(*priv->device)->GetConfigurationDescriptorPtr (priv->device, i, &desc);
1030+
kresult = (*priv->device)->GetConfigurationDescriptorPtr (priv->device, i, &desc);
10311031

1032-
if (desc->bConfigurationValue == config_value)
1032+
if (kresult == kIOReturnSuccess && desc->bConfigurationValue == config_value)
10331033
return i;
10341034
}
10351035

@@ -2160,7 +2160,11 @@ static int darwin_reenumerate_device (struct libusb_device_handle *dev_handle, b
21602160
cached_configurations = alloca (sizeof (*cached_configurations) * descriptor.bNumConfigurations);
21612161

21622162
for (i = 0 ; i < descriptor.bNumConfigurations ; ++i) {
2163-
(*dpriv->device)->GetConfigurationDescriptorPtr (dpriv->device, i, &cached_configuration);
2163+
kresult = (*dpriv->device)->GetConfigurationDescriptorPtr (dpriv->device, i, &cached_configuration);
2164+
if (kresult != kIOReturnSuccess) {
2165+
dpriv->in_reenumerate = false;
2166+
return LIBUSB_ERROR_NOT_FOUND;
2167+
}
21642168
memcpy (cached_configurations + i, cached_configuration, sizeof (cached_configurations[i]));
21652169
}
21662170

@@ -2222,8 +2226,8 @@ static int darwin_reenumerate_device (struct libusb_device_handle *dev_handle, b
22222226
}
22232227

22242228
for (i = 0 ; i < descriptor.bNumConfigurations ; ++i) {
2225-
(void) (*dpriv->device)->GetConfigurationDescriptorPtr (dpriv->device, i, &cached_configuration);
2226-
if (memcmp (cached_configuration, cached_configurations + i, sizeof (cached_configurations[i])) != 0) {
2229+
kresult = (*dpriv->device)->GetConfigurationDescriptorPtr (dpriv->device, i, &cached_configuration);
2230+
if (kresult != kIOReturnSuccess || memcmp (cached_configuration, cached_configurations + i, sizeof (cached_configurations[i])) != 0) {
22272231
usbi_dbg (ctx, "darwin/reenumerate_device: configuration descriptor %d changed", i);
22282232
return LIBUSB_ERROR_NOT_FOUND;
22292233
}

libusb/os/linux_usbfs.c

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -301,16 +301,7 @@ static const char *find_usbfs_path(void)
301301
}
302302
}
303303

304-
/* On udev based systems without any usb-devices /dev/bus/usb will not
305-
* exist. So if we've not found anything and we're using udev for hotplug
306-
* simply assume /dev/bus/usb rather then making libusb_init fail.
307-
* Make the same assumption for Android where SELinux policies might block us
308-
* from reading /dev on newer devices. */
309-
#if defined(HAVE_LIBUDEV) || defined(__ANDROID__)
310-
return USB_DEVTMPFS_PATH;
311-
#else
312304
return NULL;
313-
#endif
314305
}
315306

316307
static int get_kernel_version(struct libusb_context *ctx,
@@ -378,12 +369,16 @@ static int op_init(struct libusb_context *ctx)
378369

379370
usbfs_path = find_usbfs_path();
380371
if (!usbfs_path) {
381-
usbi_err(ctx, "could not find usbfs");
382-
return LIBUSB_ERROR_OTHER;
372+
/* On udev based systems without any usb devices /dev/bus/usb will not
373+
* exist. On android and other systems SELinux policies might block us
374+
* from reading /dev. Nonetheless it's the default for most modern linux
375+
systems including those using udev alternatives such as busybox's mdev. */
376+
usbfs_path = USB_DEVTMPFS_PATH;
377+
usbi_dbg(ctx, "could not find usbfs, defaulting to %s", usbfs_path);
378+
} else {
379+
usbi_dbg(ctx, "found usbfs at %s", usbfs_path);
383380
}
384381

385-
usbi_dbg(ctx, "found usbfs at %s", usbfs_path);
386-
387382
if (!max_iso_packet_len) {
388383
if (kernel_version_ge(&kversion, 5, 2, 0))
389384
max_iso_packet_len = 98304;
@@ -1302,6 +1297,10 @@ static int usbfs_get_device_list(struct libusb_context *ctx)
13021297
buses = opendir(USB_DEVTMPFS_PATH);
13031298

13041299
if (!buses) {
1300+
if (!usbdev_names && errno == ENOENT) {
1301+
/* The path does not exist if there are no devices plugged in */
1302+
return LIBUSB_SUCCESS;
1303+
}
13051304
usbi_err(ctx, "opendir buses failed, errno=%d", errno);
13061305
return LIBUSB_ERROR_IO;
13071306
}
@@ -1379,10 +1378,10 @@ static int linux_default_scan_devices(struct libusb_context *ctx)
13791378
* any autosuspended USB devices. however, sysfs is not available
13801379
* everywhere, so we need a usbfs fallback too.
13811380
*/
1382-
if (sysfs_available)
1383-
return sysfs_get_device_list(ctx);
1384-
else
1385-
return usbfs_get_device_list(ctx);
1381+
if (sysfs_available && sysfs_get_device_list(ctx) == LIBUSB_SUCCESS)
1382+
return LIBUSB_SUCCESS;
1383+
1384+
return usbfs_get_device_list(ctx);
13861385
}
13871386
#endif
13881387

libusb/os/windows_winusb.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1988,19 +1988,14 @@ static int winusb_get_device_list(struct libusb_context *ctx, struct discovered_
19881988
break;
19891989
case GEN_PASS:
19901990
port_nr = 0;
1991-
#if defined(LIBUSB_WINDOWS_HOTPLUG)
19921991
if (priv->initialized) {
19931992
libusb_unref_device(parent_dev);
19941993
r = LIBUSB_SUCCESS;
1995-
}
1996-
else {
1997-
#endif
1994+
} else {
19981995
if (!get_dev_port_number(*dev_info, &dev_info_data, &port_nr))
19991996
usbi_warn(ctx, "could not retrieve port number for device '%s': %s", dev_id, windows_error_str(0));
20001997
r = init_device(dev, parent_dev, (uint8_t)port_nr, dev_info_data.DevInst);
2001-
#if defined(LIBUSB_WINDOWS_HOTPLUG)
20021998
}
2003-
#endif
20041999
if (r == LIBUSB_SUCCESS) {
20052000
// Append device to the list of discovered devices
20062001
if (_discdevs) {

libusb/version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
#define LIBUSB_MINOR 0
88
#endif
99
#ifndef LIBUSB_MICRO
10-
#define LIBUSB_MICRO 29
10+
#define LIBUSB_MICRO 30
1111
#endif
1212
#ifndef LIBUSB_NANO
1313
#define LIBUSB_NANO 0
1414
#endif
1515
/* LIBUSB_RC is the release candidate suffix. Should normally be empty. */
1616
#ifndef LIBUSB_RC
17-
#define LIBUSB_RC ""
17+
#define LIBUSB_RC "-rc1"
1818
#endif

libusb/version_nano.h

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

0 commit comments

Comments
 (0)