Romain Vimont
4a95c08d56
Improve error message for unsupported usb hotplug
2022-02-10 08:54:43 +01:00
Romain Vimont
29828aa330
Log device opening errors during listing
...
Without this log, the user would have no way to know that a USB device
is rejected because it could not be opened (typically due to
insufficient permissions).
2022-02-09 10:04:09 +01:00
Romain Vimont
4692d13179
Expose simple API to select a single adb device
...
Select an adb device from the output of `adb device -l`.
PR #3005 <https://github.com/Genymobile/scrcpy/pull/3005 >
2022-02-09 09:56:26 +01:00
Romain Vimont
700503df6c
List and select USB devices separately
...
List all USB devices in a first step, then select the matching one(s).
This allows to report a user-friendly log message containing the list of
devices, with the matching one(s) highlighted.
PR #3005 <https://github.com/Genymobile/scrcpy/pull/3005 >
2022-02-09 09:55:25 +01:00
Romain Vimont
61969aeb80
Expose simple API to select a single USB device
...
The caller just wants a single device. Handle all cases and error
messages internally.
PR #3005 <https://github.com/Genymobile/scrcpy/pull/3005 >
2022-02-09 09:55:25 +01:00
Romain Vimont
b88c4aa75e
Add move-function for sc_usb_device
...
Add a function to "move" a sc_usb_device into another instance.
This will avoid unnecessary copies.
PR #3005 <https://github.com/Genymobile/scrcpy/pull/3005 >
2022-02-09 09:55:23 +01:00
Romain Vimont
0eadf95a3e
Rename function to destroy a list of USB devices
...
Rename from "usb_device_" to "usb_devices_".
PR #3005 <https://github.com/Genymobile/scrcpy/pull/3005 >
2022-02-09 09:53:19 +01:00
Romain Vimont
f20137d2ac
Improve USB device open log
...
For consistency with "List USB devices", log "Open USB device".
2022-02-07 13:10:53 +01:00
Romain Vimont
b60809a4da
Inline USB device opening
...
Such a separate function was useless.
2022-02-07 13:03:23 +01:00
Romain Vimont
b0e04aa327
Remove log_libusb_error()
...
This helper did not help a lot, and prevented the client to choose the
log level and the prefix error message.
2022-02-07 12:56:25 +01:00
Romain Vimont
1a03206e36
Detect USB device disconnection
...
The device disconnection is detected when the video socket closes.
In order to introduce an OTG mode (HID events) without mirroring (and
without server), we must be able to detect USB device disconnection.
This feature will only be used in OTG mode.
PR #2974 <https://github.com/Genymobile/scrcpy/pull/2974 >
2022-01-27 23:36:18 +01:00
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