Giter VIP home page Giter VIP logo

Comments (2)

gwgill avatar gwgill commented on July 18, 2024

It appears that if a device doesn't have a normal driver associated with it, it gets marked as having a driver install error (28) and then on IOCTL_INTERNAL_USB_CYCLE_PORT the device disappears and is not returned.
The only way of preventing this I found is to mark the device as RawDeviceOK.
To do this, a filter has to be attached to such devices that sets the RawDeviceOK flag in IRP_MN_QUERY_CAPABILITIES.
Ideally such a filter isn't attached to devices that have a normal driver.
It doesn't seem possible to determine if a device has a normal driver or not using conventional means (i.e. IoGetDeviceProperty() or IoOpenDeviceRegistryKey() to see if there is a Driver or Service value), because the PDO is not valid within IRP_MN_QUERY_DEVICE_RELATIONS.
The only workaround to this appears to be to locate the Registry Enum/USB entries for VID/PID devices, and read the Driver or Service value that way.
Devices that are marked Raw and have a corresponding Enum won't switch to using a normal driver if it is installed after the device is first plugged in. A workaround for this is to set the CONFIGFLAG_REINSTALL flag in the devices ConfigFlags value within its Registry Enum on the device being unplugged.
I've added code to do all this in the UsbDk branch here https://github.com/gwgill/UsbDk

from usbdk.

gwgill avatar gwgill commented on July 18, 2024

After further testing, it seemed that there was no reliable solution to the problem of using UsbDk to drive devices without a conventional driver. While the workaround of adding a filter driver and marking the device RawDeviceOK works for many devices, the hub port CYCLE used by UsbDk was not reliable for some combinations of devices and hubs. Such combinations results in a failure to read the correct VID/PID from the device, returning VID_0000&PID_0002 instead.

After considerable trial and error efforts, it seems that these difficult devices can indeed be made to work if they are configured and their hub port reset before doing a hub port CYCLE. The code to do this and finesse several other aspects of using UsbDk to drive a device without a conventional function driver is present in my fork of UsbDk .

from usbdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.