vpelletier / python-functionfs

Pythonic API for linux's functionfs
GNU General Public License v3.0
40 stars 13 forks source link

To make usbcat host.py application working under Windows #19

Closed mcuee closed 2 years ago

mcuee commented 2 years ago

https://github.com/vpelletier/python-functionfs/blob/master/examples/usbcat/host.py The above uses fcntl which is not available under Windows.

It is said that you can port the function of fcntl to cross platform portalocker. https://github.com/WoLpH/portalocker

vpelletier commented 2 years ago

For reference, there is another linux-only function group being used in this example: select.epoll.

But it is not actually using the biggest incompatible feature of epoll (the ability of (un)registering file descriptors while in the poll function is running), so it should be possible to replace it with something else.

mcuee commented 2 years ago

More broadly, it will be good to port the following to libusb/python-libusb1. As of now pyusb does not support async transfer so it may be difficult. But that is not relevant to this issue. https://github.com/torvalds/linux/blob/master/drivers/usb/misc/usbtest.c

mcuee commented 2 years ago

Specific to this issue, I think it is of low priority. It is just a nice to have on my side -- I like cross platform codes (often Windows is the weak link compared to Linux or even macOS).

mcuee commented 2 years ago

I will close this issue for now as it is not the core feature of this repo.