USB Device - HIDAPI or ?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
USB Device - HIDAPI or ?
I searched the forum and did not find anything. Does anyone know how to communicate with a USB HID Device using LiveCode? I am specifically wanting to control a 16 channel relay that has a HID USB interface (no serial). I know the packet structure and I have it fully implemented in xojo using HIDAPI library (github: signal11/hidapi). I would also like to use this relay in conjunction with a LiveCode application I have but not really sure where to start. I assume there is a way to access the HIDAPI library from LiveCode but starting from scratch may be beyond my skill level. I guess there is not a huge demand for this or it would already exist but it would seem like a good thing to be able to do.
Re: USB Device - HIDAPI or ?
I don't do much with USB devices, but I think Richmond and someone else were recently having a discussion about USB controllers, so maybe he'll stop in with some information about what your asking about.
*Edit - ah yes, this was the discussion I was thinking about
*Edit - ah yes, this was the discussion I was thinking about
Re: USB Device - HIDAPI or ?
here is the relay I have if anyone has any insight
its a sainsmart 16-channel-usb-hid-programmable-control-relay-module
(i was going to post a link to it but apparently i can't)
I think I could have livecode execute some terminal commands through applescript to control it but that seems pretty clumsy
its a sainsmart 16-channel-usb-hid-programmable-control-relay-module
(i was going to post a link to it but apparently i can't)
I think I could have livecode execute some terminal commands through applescript to control it but that seems pretty clumsy
Re: USB Device - HIDAPI or ?
Hi Darin,
I found these links about this product:
https://www.sainsmart.com/products/16-c ... lay-module
https://www.amazon.com/SainSmart-16-CH- ... B00TEYSJF6
Al
I found these links about this product:
https://www.sainsmart.com/products/16-c ... lay-module
https://www.amazon.com/SainSmart-16-CH- ... B00TEYSJF6
Al
Re: USB Device - HIDAPI or ?
yes that is what I have, I am looking for anyone who know how to connect to an HID device with LiveCode, I have it implemented in XOJO and node.js so I know what the packet structure looks like, just need a hint of how to connect to it with LiveCode
Re: USB Device - HIDAPI or ?
MaxV have posted an article about this some time ago:
http://livecodeitalia.blogspot.com/2014 ... ta_95.html
Here is a forum thread:
http://forums.livecode.com/viewtopic.ph ... hilit=xbee
and the Livecode API for these commands:
http://livecode.wikia.com/wiki/Read_from_driver
I do not have any device like the SainSmart to test this by myself.
http://livecodeitalia.blogspot.com/2014 ... ta_95.html
Here is a forum thread:
http://forums.livecode.com/viewtopic.ph ... hilit=xbee
and the Livecode API for these commands:
http://livecode.wikia.com/wiki/Read_from_driver
I do not have any device like the SainSmart to test this by myself.
Re: USB Device - HIDAPI or ?
After following links from old mail list and forum messages, I found this reference:
https://www.bkohg.com/service/softwareX_e.html
https://github.com/trozware/rev_stacks
After downloading these stacks and reading their scripts, tell us what you found useful for your project.
Al
https://www.bkohg.com/service/softwareX_e.html
in their webpage you could find a zipped folder (467kb) with many stacks that you need to check.The CD-ROM contains the Service-USB driver for Macintosh MacOS X, QuickTime films and screen shots as well as extensive software for AppleScript, Runtime Revolution, RealBasic, Xcode, 4th Dimension, FileMaker, MaxMSP, Java, Ragtime, Numbers, Scratch, DirectorMX, TCP/IP und der UNIX-Shell. Additionally there are original programs for various fischertechnik® construction kits.
BarCode Tester written by Sarah, could be useful too:Runtime Revolution
This contains a project exclusively for the Service USB interface and Runtime Revolution's Revolution. All input and output functions and a stepping motor control example are implemented.
Additional stacks supports the fischertechnik Computing Starter Pack and the Industry Robots II Kit. The most up-to-date version of Revolution can be found on www.runrev.com.
Revolution.zip
https://github.com/trozware/rev_stacks
After downloading these stacks and reading their scripts, tell us what you found useful for your project.
Al
Re: USB Device - HIDAPI or ?
Hi. Thanks for that information. This community is so willing to be helpful. Most of that looks to deal with a USB serial device, mine is HID (driverless) and in my research I haven't found a way to make MacOS recognize it as a serial device (I have tried extensively). But it looks like there is fairly decent support in LiveCode in going the VCP approach, so I'm going to order a USB serial relay and give it a try. I'll report back my results. Thanks!
Re: USB Device - HIDAPI or ?
Hi Darinkay,
Polling devices constantly is commonly the function of drivers.
If a program do this function, Could be flagged as a threat by
the antivirus or another program?
https://en.wikipedia.org/wiki/Polling_( ... r_science)
Al
Polling devices constantly is commonly the function of drivers.
If a program do this function, Could be flagged as a threat by
the antivirus or another program?
https://en.wikipedia.org/wiki/Polling_( ... r_science)
Al
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: USB Device - HIDAPI or ?
You are welcome to think as much as you like, but that discussion would do no good in this context.ah yes, this was the discussion I was thinking about
As far as I can understand here, the poster wants to send commands FROM a LiveCode stack to a device via a USB connexion, as would MANY of us, but LiveCode central is about as helpful on this one as . . .
Personally, I have a collection of USB "tethered" floor robots that I should like kids to control from a LiveCode stack (instead of the prefabricated software supplied with them that does NOT work properly at all).
Re: USB Device - HIDAPI or ?
Granted, but before they can do that, they have to be able to see the device being read by the OS. The conversation I referred to was the only one I remembered it being discussed in, and even failure to achieve a goal is helpful, if for nothing else than to point out what was tried preventing you from having to repeat itrichmond62 wrote: ↑Sun Sep 09, 2018 1:15 pmYou are welcome to think as much as you like, but that discussion would do no good in this context.ah yes, this was the discussion I was thinking about
As far as I can understand here, the poster wants to send commands FROM a LiveCode stack to a device via a USB connexion, as would MANY of us . . .
-
- Posts: 627
- Joined: Wed Apr 24, 2013 4:53 pm
- Contact:
Re: USB Device - HIDAPI or ?
Here I go with the zombie threads again...
I'm currently looking into building a LiveCode Builder wrapper for the cross platform HIDAPI library that was originally mentioned here.
If anyone is interested in helping that would be great. I'll probably upload to my GitHub repo once I have something actually
producing results other then returning the HIDAPI Library version number.
I'm currently looking into building a LiveCode Builder wrapper for the cross platform HIDAPI library that was originally mentioned here.
If anyone is interested in helping that would be great. I'll probably upload to my GitHub repo once I have something actually
producing results other then returning the HIDAPI Library version number.
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: USB Device - HIDAPI or ?
My "tethered" floor robots are still gathering dust in a cupboard . . .
Maybe they are slowly changing into zombies.
Maybe they are slowly changing into zombies.
Last edited by richmond62 on Fri Mar 19, 2021 11:58 am, edited 1 time in total.
-
- Posts: 641
- Joined: Tue Jul 29, 2014 12:52 am
- Location: Brazil
Re: USB Device - HIDAPI or ?
Hi PaulDaMacMan, I've never done anything involving libraries (except using them) but since I'm working on a project that is going to use an RFID reader with HID support I'm interested on what you are doing.
I'm not sure if I will be able to help but for sure I will try. Please let me know what can I do to start with
Regards
I'm not sure if I will be able to help but for sure I will try. Please let me know what can I do to start with
Regards
Simon
________________________________________
To ";" or not to ";" that is the question
________________________________________
To ";" or not to ";" that is the question
-
- Posts: 627
- Joined: Wed Apr 24, 2013 4:53 pm
- Contact:
Re: USB Device - HIDAPI or ?
So far just it logs some info on attached USB HID devices to the extension builder window. Testing on macOS 10.14.6.
https://github.com/PaulMcClernan/LCB_HIDAPI
*wchar_t is a problem, there's no 'sizeof' equivalent in LiveCode Builder to get the proper length.
https://github.com/PaulMcClernan/LCB_HIDAPI
*wchar_t is a problem, there's no 'sizeof' equivalent in LiveCode Builder to get the proper length.