USB Hid

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 10 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
waskalywabbit
Posts: 7
Last visit: Wed Apr 18, 2012 10:59 am

USB Hid

Post by waskalywabbit »

Hi all, I am new to vbscript but have done a little vb.net, hope that helps. I would like to create a script that allows me to send and receive custom usb hid data. Ultimately i want to create a microcontroller bootloader. I have searched many terms and sites but haven't been able to find anything regarding transfering data and I don't have any idea where to start.I'm quite happy to spend plently of time learning this language but I thought it best to ask how feasibly this task is as I have found little info on it.Any help at all would be greatly appreciated.Thank youDay
User avatar
waskalywabbit
Posts: 7
Last visit: Wed Apr 18, 2012 10:59 am

USB Hid

Post by waskalywabbit »

Hi all, I am new to vbscript but have done a little vb.net, hope that helps. I would like to create a script that allows me to send and receive custom usb hid data. Ultimately i want to create a microcontroller bootloader. I have searched many terms and sites but haven't been able to find anything regarding transfering data and I don't have any idea where to start.I'm quite happy to spend plently of time learning this language but I thought it best to ask how feasibly this task is as I have found little info on it.Any help at all would be greatly appreciated.Thank youDay
User avatar
waskalywabbit
Posts: 7
Last visit: Wed Apr 18, 2012 10:59 am

USB Hid

Post by waskalywabbit »

Hi jvierra, thanks for responding. The driver for usb hid is built into modern operating systems, this allows 'plug and play' compatability and thus means I shouldn't have to write a driver only obey the protocol rules.In Microsoft Visual Studio there is a hid class you can use to control the usb port and I'm hoping there is something similar in VBScript.For now I shall learn a bit more about how VBScript works and post back with my progress and hopefully more meaningful questions.Day
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

USB Hid

Post by jvierra »

By the way. If you are talking about virtual USB devices then see the USB vritualization SDK for script samples and examples.
User avatar
waskalywabbit
Posts: 7
Last visit: Wed Apr 18, 2012 10:59 am

USB Hid

Post by waskalywabbit »

This is a link to Jan Axelson's USB Hid example code;http://www.lvr.com/files/generic_hid_vb_50.zipIt is more or less a hid terminal with which you can communicate with custom hid devices and I presume defined hid's (mouse, keyboard etc). It seems to use Windows classes to communicate.Helm PCB provide a hid template and a dll file here;http://helmpcb.com/wp-content/uploads/2 ... zipHowever, the code seems to require a form to be passed to the hid controller which it in turn sends hid activity notifications to.I can get both of these working and can customise them but in terms of understanding all that is happening and being able to port the functionality into VBScript i'm a way off yet I feel.The Helm PCB approach got me thinking though, do you think it might be easier to use a usb hid dll file and learn to 'talk' to dll files in VBScript?Day
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

USB Hid

Post by jvierra »

Yu cannot use driver calls in VBScript.
There is one utility that can be downloaded and compiled with teh DDK. Iti si call DEVCON. it cansend messages to drivers.

Understand that these messges are sent to teh USB driver and NOT to the device itself. You cannot send output to a mouse. You can make driver calls to change how the mouse operates.
User avatar
waskalywabbit
Posts: 7
Last visit: Wed Apr 18, 2012 10:59 am

USB Hid

Post by waskalywabbit »

I found a way to call functions from within a dll file @http://www.codeproject.com/Articles/793 ... -VBScriptI followed the instructions on how to register the dll and tried it with the Helm PCB included mcHID.dll but i got an error stating that it was not a valid assembly.I think that this method may work but I would probably have to write a custom dll. If I do I will post it here for general interest but for now I will put this project on hold as it is starting to look like a task bigger than i would like.Thanks for all your advice jvierra, saved me heading off in the wrong direction!
User avatar
waskalywabbit
Posts: 7
Last visit: Wed Apr 18, 2012 10:59 am

USB Hid

Post by waskalywabbit »

Thanks, my main coding skills lie in microcontrollers and I have lots of projects that would benefit from a bootloader. Typically a serial bootloader is used as this is really easy and there are loads of examples available. My problem is that my laptop does not have a serial port and at some point I would want to change to usb bootloading anyway.Looking into this it would appear that the usb hid class would be the easiest to implement and again there are examples i have found. One of the reasons I would prefer to use VBScript is that I wouldn't need development software and I thought it would be an interesting way to learn and new language. On reflection this particular task is probably not suitable for a beginner but then sometimes someone has an example that they don't mind sharing.
User avatar
waskalywabbit
Posts: 7
Last visit: Wed Apr 18, 2012 10:59 am

USB Hid

Post by waskalywabbit »

Sorry I didn't expain myself fully, I will check out the DDK and forum.
User avatar
Jastin
Posts: 2
Last visit: Mon May 27, 2013 7:57 pm

Re: USB Hid

Post by Jastin »

waskalywabbit wrote:This is a link to Jan Axelson's USB Hid example code;http://www.lvr.com/files/generic_hid_vb_50.zipIt is more or less a hid terminal with which you can communicate with custom hid devices and I presume defined hid's (mouse, keyboard etc). It seems to use Windows classes to communicate.Helm PCB provide a hid template and a dll file here;http://helmpcb.com/wp-content/uploads/2 ... zipHowever, the code seems to require a form to be passed to the hid controller which it in turn sends hid activity notifications to.I can get both of these working and can customise them but in terms of understanding all that is happening and being able to port the functionality into VBScript i'm a way off yet I feel.The Helm PCB approach got me thinking though, do you think it might be easier to use a usb hid dll file and learn to 'talk' to dll files in VBScript?Day
Thank you very much for sharing those USB Hid example code.
This topic is 10 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked