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.
User avatar
waskalywabbit
Posts: 7
Joined: Tue Apr 17, 2012 7:38 am

USB Hid

Post by waskalywabbit » Tue Apr 17, 2012 8:14 am

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
Joined: Tue Apr 17, 2012 7:38 am

USB Hid

Post by waskalywabbit » Tue Apr 17, 2012 8:14 am

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
Joined: Tue Apr 17, 2012 7:38 am

USB Hid

Post by waskalywabbit » Tue Apr 17, 2012 10:05 am

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

User avatar
jvierra
Posts: 13732
Joined: Tue May 22, 2007 9:57 am
Contact:

USB Hid

Post by jvierra » Tue Apr 17, 2012 10:43 am

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
Joined: Tue Apr 17, 2012 7:38 am

USB Hid

Post by waskalywabbit » Wed Apr 18, 2012 6:11 am

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

User avatar
jvierra
Posts: 13732
Joined: Tue May 22, 2007 9:57 am
Contact:

USB Hid

Post by jvierra » Wed Apr 18, 2012 6:46 am

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
Joined: Tue Apr 17, 2012 7:38 am

USB Hid

Post by waskalywabbit » Wed Apr 18, 2012 9:36 am

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
Joined: Tue Apr 17, 2012 7:38 am

USB Hid

Post by waskalywabbit » Wed Apr 18, 2012 10:32 am

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
Joined: Tue Apr 17, 2012 7:38 am

USB Hid

Post by waskalywabbit » Wed Apr 18, 2012 10:59 am

Sorry I didn't expain myself fully, I will check out the DDK and forum.

User avatar
Jastin
Posts: 2
Joined: Sun May 26, 2013 10:49 am

Re: USB Hid

Post by Jastin » Sun May 26, 2013 10:57 am

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.

Locked