#[unsafe(no_mangle)]pub extern "C" fn rdxusb_open_device(
vid: u16,
pid: u16,
serial_number: *const c_char,
close_on_dc: bool,
buf_size: u64,
) -> i32
Expand description
Directs rdxusb to open an RdxUsb-compatible device with the associated vid/pid/serial number tuple.
rdxusb will spawn an event loop that will continually attempt to open a matching device and send/receive messages from it. If connection with the matching device is lost, reconnection is continually attempted.
- vid - USB vendor ID to match
- pid - USB product ID to match
- serial_number - an optional serial number string. This MUST be UTF-8 or NULL.
- close_on_dc - if true, closes the device handle on device disconnect
- buf_size - the maximum number of packets to buffer inbound/outbound
Returns a non-negative device handle on success, negative on error