0ee9e2ff51
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>
29 lines
467 B
C
29 lines
467 B
C
#ifndef SC_USB_H
|
|
#define SC_USB_H
|
|
|
|
#include "common.h"
|
|
|
|
#include <stdbool.h>
|
|
#include <libusb-1.0/libusb.h>
|
|
|
|
struct sc_usb {
|
|
libusb_context *context;
|
|
libusb_device_handle *handle;
|
|
};
|
|
|
|
bool
|
|
sc_usb_init(struct sc_usb *usb);
|
|
|
|
void
|
|
sc_usb_destroy(struct sc_usb *usb);
|
|
|
|
libusb_device *
|
|
sc_usb_find_device(struct sc_usb *usb, const char *serial);
|
|
|
|
bool
|
|
sc_usb_connect(struct sc_usb *usb, libusb_device *device);
|
|
|
|
void
|
|
sc_usb_disconnect(struct sc_usb *usb);
|
|
|
|
#endif
|