Can't find device in windows, please help

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
snookie
Posts: 14
Joined: Mon Sep 08, 2008 8:38 am

Re: Can't find device in windows, please help

Post by snookie » Mon Apr 27, 2009 8:38 pm

Christian -

Are you saying from usbFunctionSetup, I can still return values with the usb message pointer?

Tried this without any luck. Tried pointing usbmessage pointer to a character array and returning the size of the array.

Maybe I'm doing it wrong on the host but I always get zero back.

int return_value = usbSetReport(dev, USB_HID_REPORT_TYPE_FEATURE, buffer, 4); ?

is that right? Does usbSetReport return the value it receives back or am I supposed to pass it a return buffer?

Thanks again, almost there = ).
Jason

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Re: Can't find device in windows, please help

Post by christian » Mon Apr 27, 2009 9:17 pm

usbSetReport() sends data to the device. Use usbGetReport() to read data.

snookie
Posts: 14
Joined: Mon Sep 08, 2008 8:38 am

Re: Can't find device in windows, please help

Post by snookie » Tue Apr 28, 2009 1:46 am

Yeah, that's ridiculous. Because the data I send back is dependent on the data I send down with SetReport. So that means I need to implement a global variable that doesn't go away when functionsetup ends.

Is that right?

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Re: Can't find device in windows, please help

Post by christian » Tue Apr 28, 2009 10:22 am

Yes. That's the way how HID report descriptors work.

If you need a kind of RPC mechanism with only a couple of bytes sent to the device, consider raw setup requests with libusb-win32. This is an additional install, though.

snookie
Posts: 14
Joined: Mon Sep 08, 2008 8:38 am

Re: Can't find device in windows, please help

Post by snookie » Tue Apr 28, 2009 6:38 pm

But that's what started the discussion, I can't talk to an HID device with libusb because windows locks it. Is there a way to unlock it?

christian
Objective Development
Objective Development
Posts: 1443
Joined: Thu Nov 09, 2006 11:46 am

Re: Can't find device in windows, please help

Post by christian » Tue Apr 28, 2009 7:27 pm

Ah, sorry. Did not remember the context. Windows locks keyboards and mice, but not generic HIDs. If you have a keyboard or mouse, you probably need to send and receive a report.

snookie
Posts: 14
Joined: Mon Sep 08, 2008 8:38 am

Re: Can't find device in windows, please help

Post by snookie » Tue Apr 28, 2009 7:32 pm

Afraid you were going to say that. What a bummer, I have re-write a lot of code to get this to work in Windows.

opcode
Posts: 4
Joined: Wed Feb 25, 2009 7:57 pm

Re: Can't find device in windows, please help

Post by opcode » Thu Apr 30, 2009 4:18 pm

snookie wrote:But that's what started the discussion, I can't talk to an HID device with libusb because windows locks it. Is there a way to unlock it?


There are 2 ways to communicate with locked device in Windows that I know of.
1 : Native win calls using the DDK -> Send / Receive feature reports.
2 : Install libusb (I recommend version libusb-win32-filter-bin-0.1.8.0.exe as others I have tried have issues) and make a call to -> usb_control_msg.

What compiler are you using for your Windows software as I can only show you examples for the above for use with VC++ 2003 - 2008 ?

Also, what do you prefer, to make everyone install libusb to use your app, or should the app run without any additional drivers ?
Also libusb is very slow to enumerate devices and send data compared to native Win calls.
Having said that, libusb has it's place as it can do some things that aren't too easy using native calls.

Post Reply