Comments (6)
What is the flow when doing control transfers, and is it possible to fetch interface/endpoint descriptors (tacking on to my previous issue #48)?
It is indeed possible
When I issue this request, it completes successfully, i.e. result variable indicates a TransferSuccess, as does UsbdStatus in GenResult. However, BytesTransferred in GenResult is 0, indicating that no bytes were transferred in the request.
Is this this proper flow? Should I execute more reads after this? All in all, the questions is as previously mentioned - is it possible to fetch the device descriptor (and analogously configuration/interface/endpoint) descriptors by doing control transfer, instead of using the API functions? Thanks for having patience.
There is absolutely no problem with using control transfers instead of the given API, however this is not a proper flow, you should get a valid response with data and BytesTransferred shouldn't be zero. I think you have a bug/bugs lying somewhere in your code, the first one I noticed is the request value:
(LONG64)transferRequest->Buffer = 0x0012000001000680;
I think you mistyped the request, it should be:
0x0012000000100680 instead.
from usbdk.
@sameehj, I don't think I miss typed it, as I get 0xffffffff80000800 error when I use your value, which is USBD_STATUS_INTERNAL_HC_ERROR
if I'm not mistaken. When I use my value, I get status OK (0). Now, having looked into UsbDk code, I'm assuming that CUsbDkRedirectorStrategy::DoControlTransfer
function is called when doing a control transfer, and in it, ControlTransferAsync
seems to be called to do the transfer itself. Could it be that I have to check for the transferred bytes later if the transfer is done asynchronously?
from usbdk.
@sameehj, I don't think I miss typed it, as I get 0xffffffff80000800 error when I use your value, which is USBD_STATUS_INTERNAL_HC_ERROR if I'm not mistaken. When I use my value, I get status OK (0). Now, having looked into UsbDk code, I'm assuming that CUsbDkRedirectorStrategy::DoControlTransfer function is called when doing a control transfer, and in it, ControlTransferAsync seems to be called to do the transfer itself. Could it be that I have to check for the transferred bytes later if the transfer is done asynchronously?
@nikola-matic Sorry for the long reply I've been a bit busy lately. You are right indeed, you need to poll and check for the completion using the function UsbDk_GetRedirectorSystemHandle() (https://github.com/daynix/UsbDk/blob/master/UsbDkHelper/UsbDkHelper.h#L251)
Please refer to UsbDk's code in Libusb for an example of the usage. You can find that here: https://github.com/libusb/libusb/blob/master/libusb/os/windows_usbdk.c
Checkout the functions usbdk_do_control_transfer, usbdk_do_bulk_transfer and usbdk_do_iso_transfer.
from usbdk.
@sameehj, no worries. In fact, I realized that libusb does in fact offer the capabilities that I need (it doesn't "support" libusb_claim_interface & libusb_detach_kernel_driver calls on Windows and Darwin, which was a no no, since that's exactly what I needed - but then, looking through their code, I realized that they call UsbDk_StartRedirect in libusb_open).
In any case, I'll be using libusb with UsbDk backend instead of UsbDk directly. Thanks for the help, and I'll look into writing a simple example for redirecting a device (e.g. mouse) and doing interrupt reads from it. Thanks again!
from usbdk.
Great! Since this issue is resolved I am closing it, feel free to re open it if you think otherwise or create a new issue if needed :)
from usbdk.
Great! Since this issue is resolved I am closing it, feel free to re open it if you think otherwise or create a new issue if needed :)
from usbdk.
Related Issues (20)
- Blue Screen of Death After Installing on WINDOWS 10 HOT 9
- Problem with AbortPipe HOT 6
- Failed to compile on new setup HOT 6
- UsbDk can't work after plugging out the compound devices being directed.
- On device restart from UsbDeviceTreeView Hidden USB mass storage device are fully accessible HOT 1
- WDF_VIOLATION due to multiple power policy owners HOT 8
- UsbDK Installation failing- There is a problem with this Windows Installer package etc HOT 7
- usbdk can't work with some USB serial device(eg 076b:23c3) twice HOT 4
- USB not working after install/uninstall HOT 2
- had to uninstall this one to install the one that comes with Chimera Pro. HOT 1
- Failed to open device symlink \\.UsbDk (Access is denied. Error code =5) HOT 1
- UsbDk automatic disable usb-device HOT 5
- UsbDk_StartRedirect hangs if no normal USB driver using UsbDk V1.00-22 HOT 2
- Can't re-open device after closing it with outstanding OVERLAPPED event HOT 2
- usb 3 host controller HOT 2
- UsbDk cause win10 system in vhdx fail to startup HOT 10
- When launching MSI Installer, installer fails HOT 2
- Install grinds entire system to a halt HOT 6
- UsbDk not working in tiny11 HOT 1
- Opening the AX201 Bluetooth device causes a blue screen HOT 2
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 usbdk.