Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateFile failure #81

Open
briancg opened this issue Aug 13, 2012 · 8 comments
Open

CreateFile failure #81

briancg opened this issue Aug 13, 2012 · 8 comments

Comments

@briancg
Copy link

briancg commented Aug 13, 2012

Hello,
I am trying to use hidtest in VC++ 2010 express to communicate with an Atmel dev kit - set up as a USB HID device.

The first call to CreateFile fails (from hid_open from hid_enumerate).

Any suggestions as to what I am missing ?

Thanks
Brian

@signal11
Copy link
Owner

Did you modify the hidtest to try to open your device VID and PID? Did you try with the testgui?

@briancg
Copy link
Author

briancg commented Aug 14, 2012

Thanks for the quick response.
Yes - handle = hid_open(0x3eb, 0x2304, NULL);
Testgui does not recognise any devices ! - not even 3 mice I tried ! - or this dev kit
Just before the open_device call, device_interface_detail_data shows this content :
device_interface_detail_data->DevicePath 0x0017363c "?\hid#vid_03eb&pid_2304#7&34b7ee55&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"
Then open device returns with write_handle = 0xffffffff
It appears that the correct device has been found ?

Thanks
Brian

DevicePath = 0x00ef363c "?\hid#vid_15d9&pid_0a4d#7&231f775c&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"
The vid & pid refer to a mouse.

@briancg
Copy link
Author

briancg commented Aug 14, 2012

please ignore last 2 lines above !

@signal11
Copy link
Owner

Windows won't show keyboards and mice. You'd need something like a custom HID device or a joystick.

Download USBView and see if your device is showing up at all.
I can't find a download link on Microsoft's website, so get it from FTDI:
http://www.ftdichip.com/Support/Utilities.htm

@briancg
Copy link
Author

briancg commented Aug 14, 2012

Thanks - it does show - details as below. I did try to change it away from a mouse to avoid the windows issue...

Device Descriptor:
bcdUSB: 0x0200
bDeviceClass: 0x00
bDeviceSubClass: 0x00
bDeviceProtocol: 0x00
bMaxPacketSize0: 0x40 (64)
idVendor: 0x03EB (Atmel Corporation)
idProduct: 0x2304
bcdDevice: 0x1000
iManufacturer: 0x01
0x0409: "ATMEL"
iProduct: 0x02
0x0409: "AVR32 UC3 HID"
iSerialNumber: 0x03
0x0409: "1.0.0.0.0.0.A"
bNumConfigurations: 0x01

ConnectionStatus: DeviceConnected
Current Config Value: 0x01
Device Bus Speed: Full
Device Address: 0x02
Open Pipes: 1

Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Interrupt
wMaxPacketSize: 0x0008 (8)
bInterval: 0x05

Configuration Descriptor:
wTotalLength: 0x0022
bNumInterfaces: 0x01
bConfigurationValue: 0x01
iConfiguration: 0x00
bmAttributes: 0xC0 (Bus Powered Self Powered )
MaxPower: 0x32 (100 Ma)

Interface Descriptor:
bInterfaceNumber: 0x00
bAlternateSetting: 0x00
bNumEndpoints: 0x01
bInterfaceClass: 0x03 (HID)
bInterfaceSubClass: 0x00
bInterfaceProtocol: 0x02
iInterface: 0x00

HID Descriptor:
bcdHID: 0x0111
bCountryCode: 0x00
bNumDescriptors: 0x01
bDescriptorType: 0x22
wDescriptorLength: 0x0034

Endpoint Descriptor:
bEndpointAddress: 0x81 IN
Transfer Type: Interrupt
wMaxPacketSize: 0x0008 (8)
bInterval: 0x05

@signal11
Copy link
Owner

It still says mouse: bInterfaceProtocol: 0x02

See the HID specification for more details:
http://www.usb.org/developers/hidpage/

@signal11
Copy link
Owner

Does Atmel provide a custom HID device demo? Picking at descriptors is error-prone when you're new to USB.

@briancg
Copy link
Author

briancg commented Aug 14, 2012

Thanks ! I was wondering if I'd missed something. Atmel's windows demo is Java based, and out of date - so does not work.
Thanks for the guidance - will advise on progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants