|
 |
|
|
I am trying to unregister the HID device on the close of a form so I can use it in another program. The problem is even if I set everything to null it still does not release the hid device until I close the program.
|
| Sign In·View Thread·PermaLink | 1.00/5 (2 votes) |
|
|
|
 |
|
|
 |
|
|
file: SpecifiedOutputReport.cs
Line 16
For loop starts at 1 , should start at 0 : first byte sent was always 0 , this gave me problems.
kind regards Bakaneko
modified on Tuesday, April 8, 2008 7:01 PM
|
| Sign In·View Thread·PermaLink | 3.00/5 (1 vote) |
|
|
|
 |
|
|
Hello man,
First, thank's for that article and component. It's a great job who help me a lot.
But, I still have a problem: I develop a WPF application, and the sniffer library component seems to be incompatible with wpf, as it require a winform. I dont' know how to deal with that...
Moreover, sniffer is very coupled with the winform. Have you ever think of creating an stand-alone component ? Why not to place the winform inside the library and supply personalized events ?
Loïc
Loïc Berthollet
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Thanks for the code, it's helping me find out more about HID.
What I'm trying to do is to detect a specific device based on PID and VID (in my case a barcode scanner) then when found I want to capture all input from that device regardless of whether my app has focus or not (ideally my app will run as a windows service).
Currently running your test app i can't even detect my particular device, when I enter the vid and pid (as found from running msinfo32.exe) it detects a device being connected and disconnected but not the specified device.
If you could offer any guidance I would be very grateful. Could you also get in touch if you are available for contract work?
Dan danmoov2@googlemail.com
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
I was able to use this code and receive data from the USB barcode scanner.
What model of scanner are you using? I'm using a product from Hand Held Products (model 3800g)
3800 General Purpose Linear Image Scanner[^]
The model that I have, by default is setup as a keyboard/wedge. I had to scan a programming barcode to make it a USB HID device. By doing this it also changed the Product ID from 02E1 to 02E7. There is an option to use a USB-COM emulator that allows the device to communicate with a virtual RS232 port.
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
hi man
great job! i have been trying to catch the IR codes from my remote control for more than a month and i was too lazy to dig into HID myself. but your application did the trick.
thanks again
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi!
I'm trying to send data report to my USB device, but with no luck (i'm using your Sniffer example) It should control the LED blinking.
The SendData method doesn't work. Are you sure about writing to the USB device using FileStream ?
I hacked the USB Library and used HidD_SetFeature method and it worked. Can you please explain me how your report writing works ? I think it's a bit confusing.
Thx.
|
| Sign In·View Thread·PermaLink | 1.33/5 (3 votes) |
|
|
|
 |
|
|
Hello,
I also tried to run the program, but as i debugged it, it seems it can't find my HID device.
My HID device vendor id and product id is correct still it returns false form "SetupDiEnumDeviceInterfaces" function.
In the "while" statement :
while (SetupDiEnumDeviceInterfaces(hInfoSet, 0, ref gHid, (uint)nIndex, ref oInterface))
{....}
It always returns false...
Please let me know solution for this asap.
Thanks.
Samir Karve
|
| Sign In·View Thread·PermaLink | 2.00/5 (2 votes) |
|
|
|
 |
|
|
I managed to get the received data side of the USB HID component working with my AT89C5131 USB Development board but not the send data. I assume judging by all the "000 000 000 000" it puts in the send data field that it sends a string of data. Can anyone point me in the direction in the USB HID code to a spot where I can modify it so i only send one charactor of data, eg. if only I want to send the number 1?
|
| Sign In·View Thread·PermaLink | 3.25/5 (4 votes) |
|
|
|
 |
|
|
This seems not to work on 64 bit Vista (and possibly XP x64, I have not tested). Any ideas how to get it to enumerate the devices? At the moment it does not error but enumerates to nothing?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Ok, here was the bug. I have not looked for other similar bugs.
In the definition of the struct DeviceInterfaceData, "Reserved" is given the type int. In the documentation it should correspond to ULONG_PTR. This means that UIntPtr (or maybe IntPtr) should be used instead. This is confirmed to work on 32 and 64 bit systems.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
That is also my thread. I made it at about the same time as I posted the last comment. 
Please look at my sourceforge project http://sourceforge.net/projects/libhidnet[^][^]. It runs on 32 and 64 bit Windows as well as Linux (and anything else with Mono and hiddev - I haven't checked which systems have hiddev). I haven't had any feedback on it yet or any suggestions but they are very welcome as I don't have much time to work on it.
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Thanks again for the two fixes. Now that my code, mostly derived from this project, is working with 64-bit Windows I'm afraid I'm not motivated to do anything with your new project. But you are to be lauded for having done it and made it available. Thanks.
Rennie
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hello guys,
I have tried recently to run the program, but as i debugged it, it seems it can't find my usb flash drive. The "while" statement :
while (SetupDiEnumDeviceInterfaces(hInfoSet, 0, ref gHid, (uint)nIndex, ref oInterface))
{....}
in
public static HIDDevice FindDevice(int nVid, int nPid, Type oType)
doesn't reach my usb's vendor_id and product_id
Thanks for your time!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Hi eythimis,
Because a USB Flash Drive doesn't belong to the HID device class you can't find him right now. In most cases a Flas Drive is a (bulk) USB Mass storage Device. You can change the GUID ID (Search for the right GUID on the internet) in the program code to find the device. But Interfacing a bulk device does need other code, so anything but recognising shall need some additional coding.
Greetings wimar
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
I'm having a similar issue but using a Magtek HID device... i have 4 HID devices installed on this machine - but when i hit while (SetupDiEnumDeviceInterfaces(hInfoSet, 0, ref gHid, (uint)nIndex, ref oInterface))
...it evaluates the first item and then falls out of the loop without evaluating any other items. I'm going to dig into the windows API - but thought you might have a quicker solution. 
|
| Sign In·View Thread·PermaLink | 3.00/5 (1 vote) |
|
|
|
 |
|
|
I wonder if someone has implemented a general data transfer over USB. I want to communicate with a PIC (microcontroller) with a C# program, by USB.
If you want to upload your own programs and games, visit my site http://www.mysmallprograms.com/
|
| Sign In·View Thread·PermaLink | 1.17/5 (3 votes) |
|
|
|
 |
|
|
Hi there, I need to get Specified Device to return the Product Name and vendor Name, but there's a problem when I try to Find the Specified Device :
This is the code I put after Device Arrived : private void usb_OnDeviceArrived(object sender, EventArgs e) { this.lb_message.Items.Add("Found a Device"); HIDDevice hid1 = SpecifiedDevice.FindSpecifiedDevice(int.Parse("4D8", System.Globalization.NumberStyles.HexNumber), int.Parse("FF9D", System.Globalization.NumberStyles.HexNumber)); }
and it raised error : Additional information: Msg:UsbLibrary.HIDDeviceException: Msg:Failed to get the detailed data from the hid. WinEr:00000000 at UsbLibrary.HIDDevice.Initialise(String strPath) in C:\Documents and Settings\wimar.GRAFIDRUK\My Documents\Avans School\BLOK 12\Project RF Sniffer\PC Applicatie\Sniffer\UsbLibrary\HIDDevice.cs:line 111 at UsbLibrary.HIDDevice.FindDevice(Int32 nVid, Int32 nPid, Type oType) in C:\Documents and Settings\wimar.GRAFIDRUK\My Documents\Avans School\BLOK 12\Project RF Sniffer\PC Applicatie\Sniffer\UsbLibrary\HIDDevice.cs:line 257
What's Wrong ?
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
The error goes from HIDDevice.cs (Ln.265)
oNewDevice.Initialise(strDevicePath); where the strDevicePath = "\\\\?\\hid#vid_04d8&pid_ff9d#6&3aa3f0e7&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
I have got to same problem with Mr.Iwan Budihalim.
oNewDevice.Initialise(strDevicePath); where the strDevicePath = "\\?\hid#vid_067e&pid_0100#6&369a9828&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"
I want to get data of barcode reader. Please help me!
Hoac Tai Thien
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
Same problem with same error as above. I'm running WinXP and compiling with Visual C# 2008 Express.
Anybody found the reason????
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
In the HIDDevice file there is a method called FindDevice(int nVid, int nPid, Type oType), in this method you will find code to get the product en vendor id. by using the GetDevicePath(hInfoSet, ref oInterface); will return a string with informatie like vendor and product id.
greetings wimar
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |