Comments (4)
I see your point, but these decisions were already made by libusb authors, so I would say that a wrapper shouldn't place additional restrictions. Rather, it should do whatever libusb would do if reset
is called in parallel with other operations, assuming that such use is valid.
In my case, I wrote a wrapper around libusb's async transfer API, which required putting the DeviceHandle
behind an Arc
, but then needed access to some of the &mut self
methods elsewhere. Worked around it with unsafe
, but didn't see a good reason why that should be needed. I can also envision use cases where you actually do want to reset the device while other things are happening to implement watchdog-like functionality.
from rusb.
You can share DeviceHandle
with Arc
even some of function take &mut self
. I think it's good protection to call this function if you own DeviceHandle
. No one prevent you share DeviceHandle
with Arc
and call write_bulk
/read_bulk
from multiply thread. But what happened if you read or write in one thread and try to reset
or clear_halt
in other. And that's why these functions take &mut self
.
We can discuss how this should be handled.
from rusb.
Ok. I am agree. I will try to make new update for library. But I think it will be at the end of October or begin November. It will be breaking changes.
from rusb.
Just take note libusb_reset()
behavior is platform dependant. Under Windows it may be even driver dependant. libusb gives the freedom to the user and user can shoot themselves by calling libusb_reet()
in a multithread application.
As for rusb, I think it does not really need to follow libusb in this aspect.
from rusb.
Related Issues (20)
- Release request HOT 7
- How to read an usb keyboard entry in windows 11? HOT 3
- Unable to crosscompile with i686-pc-windows-gnu toolchain HOT 2
- I want to compile an application that does not contain any dynamic libraries HOT 4
- Question regarding linux gadget mode HOT 2
- Logic behind the UsbContext trait HOT 2
- Failing to build with regular/default vcpkg on Windows 10 HOT 4
- Failing to build vendored on Windows 10 HOT 2
- "vendored" Feature feature is not clearly documented HOT 1
- [winusb_open] unsupported API call for 'open' HOT 1
- Trying to flash a chip, but getting "Can't init Global usb context, error Other" HOT 2
- Wrapper for libusb_get_ss_endpoint_companion_descriptor
- Get Usb Devices Vendor, Model and Serial Number HOT 6
- read_device.rs example ejected USB flash drive HOT 1
- K8055 Board fails to detach kernel driver on MacOS HOT 3
- Err: Busy HOT 3
- Next release on crates.io HOT 3
- libusb_set_iso_packet_lengths panics on debug builds in newest nightly (2024-03-27)
- open_device_with_vid_pid not working as expected HOT 2
- windows build failed for me until manual vcpkg install HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rusb.