Make serial mandatory for sc_usb

In practice, it is already mandatory.

PR #2974 <https://github.com/Genymobile/scrcpy/pull/2974>
This commit is contained in:
Romain Vimont 2022-01-26 21:38:28 +01:00
parent 1d6f9952ee
commit 48e3ff284f

View file

@ -43,10 +43,6 @@ accept_device(libusb_device *device, const char *serial) {
static libusb_device * static libusb_device *
sc_usb_find_device(const char *serial) { sc_usb_find_device(const char *serial) {
if (!serial) {
return NULL;
}
libusb_device **list; libusb_device **list;
libusb_device *result = NULL; libusb_device *result = NULL;
ssize_t count = libusb_get_device_list(NULL, &list); ssize_t count = libusb_get_device_list(NULL, &list);
@ -81,6 +77,8 @@ sc_usb_open_handle(libusb_device *device) {
bool bool
sc_usb_init(struct sc_usb *usb, const char *serial) { sc_usb_init(struct sc_usb *usb, const char *serial) {
assert(serial);
// There is only one device, initialize the context here // There is only one device, initialize the context here
if (libusb_init(&usb->context) != LIBUSB_SUCCESS) { if (libusb_init(&usb->context) != LIBUSB_SUCCESS) {
return false; return false;