vpelletier / python-libusb1

Python ctype-based wrapper around libusb1
GNU Lesser General Public License v2.1
168 stars 65 forks source link

How to set `libusb_transfer.flags` #92

Closed WeiminWangKolmostar closed 6 months ago

WeiminWangKolmostar commented 6 months ago

First, thanks for your awesome work.

I noticed that libusb doesn't provide an api to set the flag member of libusb_transfer, and python-libusb1 doesn't expose the libusb_transfer's members (code).

So is there a way to set libusb_transfer.flags in python-libusb1.

WeiminWangKolmostar commented 6 months ago

Update: I found python-libusb1 does set libusb_transfer's members (see here)

So the following code can be used to set the libusb_transfer.flags:

transfer = usb_device_handle.getTransfer()
transfer._USBTransfer__transfer.contents.flags = 1  # LIBUSB_TRANSFER_SHORT_NOT_OK
WeiminWangKolmostar commented 6 months ago

Add a PR to provide a method to do this.