same rules apply with any language, look at the mcHID API reference. But seems NOBODY want to use the serial number... no matter why they suffer
Nice utility Darrel!
same rules apply with any language, look at the mcHID API reference. But seems NOBODY want to use the serial number... no matter why they suffer
Nice utility Darrel!
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Well, if there was an easy way to do it, it might look more attractive.
Running EasyHID or manually editing the descriptor file each time doesn't seem like an option.
Maybe there's a way to have the descriptor file read the Hardware Serial number, then have the programmer auto-increment the serial number, ... but it doesn't currently have that feature.
Other than that, since you can find the handle of each device with the same Vendor/Product ID, within your software you can create a Challenge/Response type arrangement that will let the computer assign a unique number to any new devices on the BUS.
Thanks Steve,Nice utility Darrel!
It's come in handy a few times troubleshooting USB connections.
Thought I'd spruce it up and pass it on.
<br>
DT
On another forum someone already Suggest USBDeview. I use it a lot, it's a real nice utility ...
http://www.nirsoft.net/utils/usb_devices_view.html
They also have bunch of other nice freebies over there...
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
well... when you did that utility... wasn't it to learn something ?
And i'm sorry... i thought i posted that link before.. oops!
It's still a nice utility you've made so far!
Last edited by mister_e; - 1st December 2007 at 02:01.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Excellent point! That's exactly what it was.
That program started from my attempt at modifying the USBDemo program from VB to Delphi.
It's based on the Delphi routines supplied by David Barker in the EasyHID results.
It's only right that I posted it here,... along with the reason I even know about USB. (USBDemo)
<br>
DT
if i find time, i may elaborate USBDemo a little bit more, but you know how busy i am right now with some current project + that ASM one
For some spare time... my new toys... Delphi, EasyDsPIC 4, PoScope and PIC32s
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Ok i will use Darrelīs exe program.
I know it will not be exactly the same for VB but if there is any chance that you could post the source code i would finally see how itīs done!
I am sure i can do with just the handler, i could also identify wich device was connected first and have a record of devices....
This would be a great place to begin
Thanks for your replies
DJC
Thank You!<hr>Originally Posted by Josuetas
Looking at the VB side of USBDemo
Using the line shown in red, anytime a device is plugged in with the same Vendor/Product ID, it will forget about the last device and start using the new one.Code:Public Sub OnPlugged(ByVal pHandle As Long) ' ' A HID device has been plugged in, ' check if it's the right one, and enable the form LED (top left) ' Dim DeviceHandle As Long Dim VendorName As String * 15 Dim ProductName As String * 15 If hidGetVendorID(pHandle) = VendorID And hidGetProductID(pHandle) = ProductID Then ' Good one? ' ' get the device handle ' ===================== DeviceHandle = hidGetHandle(VendorID, ProductID) ' ' Get the vendor and product name from the handle ' =============================================== hidGetVendorName DeviceHandle, VendorName, 255 hidGetProductName DeviceHandle, ProductName, 255 ' ' Enable the LED and display device information ' VendorName and ProductName ' ============================================= imgON.Visible = True lVendorName.Caption = VendorName lProductName.Caption = ProductName End If End Sub
To get around that, you need to check further to make sure it's the device you want to talk to. And, for that, you need to search through the HID Device list.
Again, I don't do VB, so the syntax is most probably wrong. But ...<hr>
The function hidGetItemCount returns the number of HID devices in the List.
Then hidGetItem(Index) returns the handle of the item in the list that's specified by Index (0 to count-1).
You can get the info about that device by requesting each field.
Vendor = hidGetVendorID(handle)
Product = hidGetProductID(handle)
Serial = hidGetSerialNumber(handle)
Now if everything matches, you know you have the right one. If not, keep searching through the list.
If you're not using the Serial Number, you'll need to send/receive something to the device to figure out if it's the correct one.
Is that any help?
I'll keep trying if not.
<br>
Last edited by Darrel Taylor; - 2nd December 2007 at 00:18. Reason: added "hid" to function names
DT
Steve, do I need the 18f4550 or any other USB pic for your USB project? or can I do it with a standard pic, like the 18f452?
Atwoz, only USB PIC will work!
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks