Re: USBAttachDevice : LPCUSB_INTERFACE UsbInterface = NULL

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,
I'm not sure what you mean by "first time". (first time device is plugged in?)
The code that failed was a 1-on-1 copy of the USBPRN driver.
Or do you mean that USBAttach device is called multiple times ? (did not see
that)

I ommitted the problem nog by just not using the pointer.
(it's only used in 1 place, for a check that I don't think I need.)
My device is reported as having 2 interfaces, the second one having 2
endpoints (bulk_in/bulk_out).
I am guessing that that's the one I need, but that's just guesswork sofar.
The interface class for that interface is reported as 10, I have searched
everywhere for a list of interface classes numbers (note: not the GUID) and
their meaning, but have not found it yet. So I just assumed it would be
correct and adjusted the software-checks accordingly.

ActivateDevice & Init are beeing called in my driver now, tomorrow I will
try to open the device and read from it. It would suprise me if it works the
first try....
In the mean time any tips that might help me are welcome.

Greetings,
Rob.










"Michael" wrote:

On 3 juin, 16:23, Rob <R...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Is is passed from USBD hardcoded NULL....
so I guess the printer sample would just crash ?
strange...

Rob.

"Rob" wrote:
Hi,
I am building an USB-CDC driver.
I started from scratch with just the basic stream interface.
At this point, I plug in my device, it is recognized from the regsettings I
made, my DLL is loaded, and USBDeviceAttach is called.

From this point, I am using the PRN driver as an example.
I copied ParseUsbDescriptors() but this fails.
(do I need it anyway ?, the device is already the right one, else my driver
wouldn't have been loaded... (???), or is it also loaded under differrent
circumstances ? )

It fails because the UsbInterface pointer passed to USBAttachDevice is NULL.
Why is that ?

BOOL USBDeviceAttach( USB_HANDLE hDevice,LPCUSB_FUNCS UsbFuncs,
LPCUSB_INTERFACE UsbInterface,LPCWSTR UniqueDriverId,
LPBOOL AcceptControl, LPCUSB_DRIVER_SETTINGS UsbDriverSettings,
DWORD Unused)

Greetings,
Rob.

This is only passed the first time at NULL (at device level). Then for
each interface, a pointer on the interface is passed... That's the way
the printer, the mass storage, .. work...

HTH

Mike

.



Relevant Pages

  • Re: USBAttachDevice : LPCUSB_INTERFACE UsbInterface = NULL
    ... called with NULL for interface parameter. ... If you take the printer class as example for your driver, ... I'm not sure what you mean by "first time". ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Linux Firewall/LoadBalancer
    ... The bonding driver originally came from Donald Becker's beowulf patches for ... Build kernel with the bonding driver ... "Bonding driver support" in the "Network device support" section. ... so the bonding driver will automatically load when the bond0 interface is ...
    (Security-Basics)
  • [PATCH] IPMI driver updates, part 2
    ... It has been far too long since the last IPMI driver updates, ... This second part adds the "System Interface" driver. ...
    (Linux-Kernel)
  • [2.6 patch] remove comx driver docs
    ... info on the driver for Baycom style amateur radio modems ... -LMI) protocols are available as link-level protocol. ... -The COMX driver set has a new type of user interface based on the /proc ... -To create the interface 'comx0' which is the first channel of a COMX card: ...
    (Linux-Kernel)
  • [2.6 patch] remove the documentation for the legacy CDROM drivers
    ... This patch removes the documentation for the removed legacy CDROM drivers. ... SC1200 WDT DRIVER ... LaTeX document on standardizing the CD-ROM programming interface. ... THIS DRIVER WILL WORK WITH THE CD-ROM DRIVES LISTED, ...
    (Linux-Kernel)