|
I'm running this on Windows 7X64 (Compiled for X32 systems)
I can see my device HID\VID_06A3&PID_80C1 and can see when SOME data is captured.
The problem is the LCB appears to be Wrong?
When running USBTrace, Ill get data 00 00 02 08 00 00 20
But this (And other apps) I get 00 00 02 08 00 00 00
Now I can tell most key presses but I'm missing the
keypads Mode & button 21 (both are contained in this last byte)
Also If I'm not in mode 00 00 02 08 00 00 20 (Green Mode)
I'm getting Data: 00 00 02 08 00 00 00 00
Vs Data: 00 00 02 08 01 00 00 00
When pressing one of the normally working keys (USBTrace Shows valid data being sent)
|
|
|
|
|
Does this component work with Windows CE 5.0? I am using something derived from it, and it is not finding hid.dll, and I was hoping you could tell me where to look for the hid functions.
Thanks
Dave Stevens
|
|
|
|
|
cool,let's me learn....TKS
|
|
|
|
|
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
usb.RegisterHandle(Handle);
}
protected override void WndProc(ref Messagea m)
{
usb.ParseMessages(ref m); (Here i m getting Error "Object reference not set to an object.")
base.WndProc(ref m);
}
Can any body reply me with his best.....
Please I m waiting..
|
|
|
|
|
I've compile the hid example with Visual Studio 2010 on a vista machine. It detects my USB HID device. However, when I click on send data. I get an exception on the filestream.Write() method in
this section of the code:
try
{
m_oFile.Write(oOutRep.Buffer, 0, oOutRep.BufferLength);
}
catch (IOException ex)
{
throw new HIDDeviceException("Probbaly the device was removed");
}
catch(Exception exx)
{
Console.WriteLine(exx.ToString());
}
The
IOException "The Parameter is incorrect". Which is completely vague. Does anyone else out there have this working when they compile with a later version of Visual Studio 2010. Any ideas of what is wrong? I have not modified the code, but did update the project to the VS 2010 through the automatic conversion.
Also I noticed that the build is set to use .NET 2.0. Will it work with 4.0?
Thanks in advance.
Tim
|
|
|
|
|
Yes, this project works fine on VS2010. I recently created a C# COM DLL wrapper that communicates successfully with an Ingenico 6550. Mind you, I had to do some tweaking to the base classes to get the protocol to work properly, but it's working nicely.
As for your error: I think I originally got something similar because I wasn't populating the first couple of bytes of the output report correctly (first byte was host ID, second was message length, and last was CRC). I would set up a USB trace of the device on a working application so you can see what is being sent to and received from the device. That way, you'll know exactly what you are supposed to send to the device to get it to work.
Since the original library was 2.0 framework, I left everything that way. I don't know if it will work in 4.0, though I can't see why it wouldn't.
|
|
|
|
|
I want to express my appreciation to GS-Scooter for his response.
He diagnosed the problem exactly. The sniffer hid app has a send button with a bunch of default 0 bytes. I was just hitting the button and sending all zeros to the hid device.
I'm using one of the new MSP430550X USB devices from TI. The TI sample app was written in C++ and works fine, so I incorrectly assumed that it was some sort of .NET or C# problem, since I'm new to C#. After getting the above response, I looked at the TI demo amp and realized that it was setting a record ID= 63, the length of data, and then the data itself in the output report. I copied this data into the output report of the sniffer hid app, and it worked beautifully!!! I even got the expected response.
My bad assumption was that the device would just be sent all zeros, and windows wouldn't know the difference. It never occurred to me that the function will throw an exception based on data in the report given that it's just a bunch of bytes. Any other time, I've written to a file or device, the content of the data itself is not critical to whether the stream operation fails or not.
I guess with USB, it needs at minimum the first byte of the report to be a valid report number, otherwise the USB device rejects the data, and an a vague exception bubbles up the chain, and you end up waisting 3 days of time trying to figure out what is wrong.
I'm not sure if I'm the only ignorant person who uses this sample app, but it would be nice to comment in the code somewhere, or even have a message box warning pop up if all the data is zero, to warn people that they must send a valid record, or an exception will occur.
Anyhow - thanks again.
|
|
|
|
|
You're very welcome. Glad that worked out for you.
Don't forget that if you want to send a message to the device that exceeds its maximum report length (32 bytes in Ingenico's case), you'll need to break it up into multiple packets with the first 2 bytes being populated accordingly.
|
|
|
|
|
Hey dudes, any idea how to obtain the Vendor Name and Product Name from the HID device? (and I do not mean the pid and vid as wimar proposed ages ago)
Thanx a lot for any (correct) answer!
Vl.
|
|
|
|
|
Well, finally I found it. Take a look at msdn, search for these keywords:
<br />
HidD_GetManufacturerString<br />
HidD_GetProductString<br />
HidD_GetSerialNumberString<br />
and/or
<br />
HidD_GetIndexedString<br />
Implementation is quite easy morning exercise, but if you need a little push, leave me a message.
Cheers!
Vl.
|
|
|
|
|
i am trying to implemet this library for a logitech momo steering wheel, or any device and when i enter the ventor id and product id i press OK and nothing happends,
|
|
|
|
|
Hi wimar
I run the sample application under windows 7 64 in x86 mode. the application detects the usb device i want to find but it couldn't open the file to read/write to the device. the error code is 0x5 = ERROR_ACCESS_DENIED or 0x20 = ERROR_SHARING_VIOLATION.
Thx 4 ur help
blackbondi
|
|
|
|
|
Hi blackbondi, I'm not sure what's happening but the problem you've reported is related to unsufficent user privileges. Are you running your app as Administrator?
|
|
|
|
|
Try modifying UsbLibrary.HIDDevice.Initialise (sic) to do this:
private void Initialise(string strPath)
{
m_hHandle = CreateFile(strPath, GENERIC_READ | GENERIC_WRITE, 0, IntPtr.Zero, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, IntPtr.Zero);
if (m_hHandle == InvalidHandleValue)
{
m_hHandle = CreateFile(strPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, IntPtr.Zero);
}
|
|
|
|
|
I am using usblibrary.dll in a vb.net 2010 32bit app I'm creating. I was wondering if anyone had a similar issue with this and if so on how to correct it.
My app is a MDI app. When I click a button on the parent form it opens the child form. On the child form I que a list of USB devices from an SQL server. I click on the desired device, and it fills the child form with its attributed stored from the server. I also have a few buttons on this child form. One of them being "Connect" I click this and it connects fine. When I close this child form I call
Private Sub frmHardwareDevice_FormClosing(sender As Object, e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
UsbHidPort1.SpecifiedDevice.Dispose()
End Sub
When I do this it shuts my whole app down. Any suggestions here.
thanks in advance
|
|
|
|
|
When I connect it - it shows up in Device Manager.
I can enumerate it and find it.
But I can't open a connection using CreateFile() because it's already being used by the OS.
Can I "take it away" for my own use? Force a close so I can grab it or something?
My application will be unattended so I can't physically unplug and replug the USB port.
This is my last hurdle to get this thing working! (yeah, sure)
I appreciate the community around here that can share collective wisdom.
Thanks.
|
|
|
|
|
Hi did you ever get this functioning? I am trying similar program to gather info from Tripp Lite battery.
|
|
|
|
|
Try modifying UsbLibrary.HIDDevice.Initialise (sic) to do this:
private void Initialise(string strPath)
{
m_hHandle = CreateFile(strPath, GENERIC_READ | GENERIC_WRITE, 0, IntPtr.Zero, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, IntPtr.Zero);
if (m_hHandle == InvalidHandleValue)
{
m_hHandle = CreateFile(strPath, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, IntPtr.Zero);
}
|
|
|
|
|
This function always return false in HIDDevice class (FindDevice) :
SetupDiEnumDeviceInterfaces(hInfoSet, 0, ref gHid, (uint)nIndex, ref oInterface)
So it will always return null and it won't select any device...
Somebody please help what should I do?
|
|
|
|
|
See the last post, referring to Windows 7 / 64 bit solutions. Coincidentally, you and I are working on this on the same day. The solution posted worked out great for me.
|
|
|
|
|
Thank you for your post, It did solve the last problem!
But sadly there is another one; my device "strPath" path is "\\\\?\\hid#vid_09da&pid_000a#6&2cbaae4f&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}" and this function "m_hHandle = CreateFile(strPath, GENERIC_READ | GENERIC_WRITE, 0, IntPtr.Zero, OPEN_EXISTING, FILE_SHARE_READ, IntPtr.Zero);" always is returning "-1" which means "INVALID_HANDLE_VALUE"
I checked my device path in USB Monitor it returns "\??\USB#VID_09DA&PID_000A#5&39e291f2&0&2#{a5dcbf10-6530-11d2-901f-00c04fb951ed}"
I tried every thing but it still doesn't work! Am I doing some thing wrong?
modified on Wednesday, May 18, 2011 8:33 AM
|
|
|
|
|
I wish I could help you... it looks like your VID and PID are in the string. Isn't there something in the Windows kernel that keeps all mouse, keyboard, and monitor interrupts for itself? I've never heard of anybody doing any monitor coding...
|
|
|
|
|
I had the same problem and it looks like this happens when the device is being used by something else.
|
|
|
|
|
Thank you for your great USB library!
I modified the library so it supports multiple identical USB devices.
I just added an extra field to USBHidPort called DeviceIndex. This is the 0-based index of the device you are looking for.
You can download the lib here
http://www.multiupload.com/CX3V7T40ZX[^]
Maybe you can include my modification in your next update.
|
|
|
|
|
How Do I change The product and vendor ID of an existing usb library. I need to change the vendor ID to 045E and the Product ID to 0291 how do I do this exactly and what programs do I need to use thanks for your time any help would be greatly appreciated. Also where is the property box located I searched everywhere can't find it is it the sniffer application boxes or in the usblibrary .dll ?
|
|
|
|