Romain Vimont
8fc9dca8cb
Make serial optional to find USB devices
...
If no serial is provided, then list all available USB devices (which can
be open and having a serial).
PR #2974 <https://github.com/Genymobile/scrcpy/pull/2974 >
2022-01-27 23:36:15 +01:00
Romain Vimont
1c17f57c10
Find a list of devices instead of a single one
...
Several devices may match the requested serial, but above all, this
paves the way to list all devices (when no serial is provided).
PR #2974 <https://github.com/Genymobile/scrcpy/pull/2974 >
2022-01-27 23:36:13 +01:00
Romain Vimont
d8b37fe189
Wrap libusb_device
...
Introduce a structure to wrap a libusb_device and expose its descriptor
data read during discovery.
PR #2974 <https://github.com/Genymobile/scrcpy/pull/2974 >
2022-01-27 23:36:11 +01:00
Romain Vimont
0ee9e2ff51
Expose function to find a USB device
...
The device was automatically found by sc_usb_connect(). Instead, expose
a function to find a device from a serial, and let the caller connect to
the device found (if any).
This will allow to list all devices first, then select one device to
connect to.
PR #2974 <https://github.com/Genymobile/scrcpy/pull/2974 >
2022-01-27 23:36:08 +01:00
Romain Vimont
1ab3692f3d
Add util function to read USB descriptor string
...
Use it from accept_device() to simplify (at the cost an additional
allocation for each serial, but it is not important).
It will also be useful in other functions in further commits.
PR #2974 <https://github.com/Genymobile/scrcpy/pull/2974 >
2022-01-27 23:36:06 +01:00
Romain Vimont
bbef426a4b
Split USB initialization and connection
...
This will allow to execute other USB calls (retrieving the device list
for example) before connecting to the selected device.
PR #2974 <https://github.com/Genymobile/scrcpy/pull/2974 >
2022-01-27 23:36:04 +01:00
Romain Vimont
2114f48185
Find device with USB context
...
An explicit context was used everywhere except for listing the devices.
PR #2974 <https://github.com/Genymobile/scrcpy/pull/2974 >
2022-01-27 23:36:02 +01:00
Romain Vimont
b779eca8d3
Remove libusb_device field
...
It is possible to retrieve the device instance from the handle via
libusb_get_device(), so we don't need to reference the device one more
time.
PR #2974 <https://github.com/Genymobile/scrcpy/pull/2974 >
2022-01-27 23:36:00 +01:00
Romain Vimont
48e3ff284f
Make serial mandatory for sc_usb
...
In practice, it is already mandatory.
PR #2974 <https://github.com/Genymobile/scrcpy/pull/2974 >
2022-01-27 23:35:57 +01:00
Romain Vimont
1d6f9952ee
Extract USB handling from AOA
...
The AOA code handled both USB initialization and AOA commands/events.
Extract USB-related code to a separate file and structure.
PR #2974 <https://github.com/Genymobile/scrcpy/pull/2974 >
2022-01-27 23:35:55 +01:00