Thanks! I very much appreciate your testing it as well. I have Windows 10 reinstalled now so I can test too, but the more testing with a variety of devices the better. I have a feeling it might stumble a little on Manufacturer/Product names that have non-ANSI characters (like Unicode Chinese characters) for example, but none of the devices I own and tested with have multi-byte characters in those name elements.SparkOut wrote: ↑Wed Mar 17, 2021 8:47 pmGreat, thanks Paul. I can't tell you how much I applaud your efforts.
I will probably get a chance to try it out this weekend, hopefully so, because I'll be away in the Western Isles without decent mobile data or my own computer next week. I will give you feedback as soon as I can.
USB Device - HIDAPI or ?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 627
- Joined: Wed Apr 24, 2013 4:53 pm
- Contact:
Re: USB Device - HIDAPI or ?
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: USB Device - HIDAPI or ?
I think I'm being a bit stupid:
-
-
-
- Posts: 627
- Joined: Wed Apr 24, 2013 4:53 pm
- Contact:
Re: USB Device - HIDAPI or ?
Is that a rhetorical question? Is the HIDAPI LiveCode Builder Extension loaded? If not then the stack isn't going to do anything but throw errors. HIDAPIInit() should init the library and either return the version string of the HIDAPI Library or the message "error initializing HID API". The rest is commented out because I moved those lines to a separate button that gets the device list and updates the dataGrid. This is all very much a work in progress and so I'm changing things around frequently.
I made a new video showing using the lib with a Nintendo Wiimote, filtering of incoming data through a "data description string" (in the bottom field, filter function in the button script that does the device polling). https://www.youtube.com/watch?v=oeh5VOE-N5E
Re: USB Device - HIDAPI or ?
Hi Paul,
Your HIDAPI lcb extension works fine on MacOSX 10.11.6
using Livecode Indy 9.6.1
I have to search "How to install LCB in Livecode" on google:
https://livecode.com/topic/installing-an-lcb-library-2/
Somehow, I managed to stuck my mouse pointer and had to
quit Livecode using the keyboard. After quitting, the mouse
worked again.
Using a broken gamepad, I tested again and found with surprise
that every gamepad button works fine.
This gamepad generates a string of 8 numbers but only 1 or 2
actually change after pressing a button.
Number values are just one of these 3 numbers: 255, 128, 0
Vendor name is Honey Bee identified with ID 1A5C
https://www.flipkart.com/genius-maxfire ... z9czk5g4yp
Al
Your HIDAPI lcb extension works fine on MacOSX 10.11.6
using Livecode Indy 9.6.1
I have to search "How to install LCB in Livecode" on google:
https://livecode.com/topic/installing-an-lcb-library-2/
Somehow, I managed to stuck my mouse pointer and had to
quit Livecode using the keyboard. After quitting, the mouse
worked again.
Using a broken gamepad, I tested again and found with surprise
that every gamepad button works fine.
This gamepad generates a string of 8 numbers but only 1 or 2
actually change after pressing a button.
Number values are just one of these 3 numbers: 255, 128, 0
Vendor name is Honey Bee identified with ID 1A5C
https://www.flipkart.com/genius-maxfire ... z9czk5g4yp
Al
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: USB Device - HIDAPI or ?
OK: Here I am being really stupid, BUT, HOW do I download a unified X.lcb from here?
https://github.com/PaulMcClernan/LCB_HIDAPI
https://github.com/PaulMcClernan/LCB_HIDAPI
-
- Posts: 627
- Joined: Wed Apr 24, 2013 4:53 pm
- Contact:
Re: USB Device - HIDAPI or ?
I'm not sure what you mean by "unified X.lcb" from there? There isn't a file named that in this project.richmond62 wrote: ↑Tue Apr 13, 2021 9:15 amOK: Here I am being really stupid, BUT, HOW do I download a unified X.lcb from here?
https://github.com/PaulMcClernan/LCB_HIDAPI
If you want to try it out you'll have to download the project and load it into Extension Builder in LC
-
- Posts: 627
- Joined: Wed Apr 24, 2013 4:53 pm
- Contact:
Re: USB Device - HIDAPI or ?
Excellent! Thanks so much for testing! I've tried to keep backwards compatibility wherever I can, some of my other LCB should. theoretically, work as far back as SnowLeo 10.6. I was on Sierra for a long time for that reason, but I recently got forced into updating to macOS 10.14.6.
A good slide show to keep as general LCB reference!capellan wrote: ↑Tue Apr 13, 2021 2:32 amI have to search "How to install LCB in Livecode" on google:
https://livecode.com/topic/installing-an-lcb-library-2/
Hah! I did the same testing it with an MS mouse. After that I thought I had added another escape from the polling loop script. Try holding down the escape key to stop the loop and close the device, which should release it back to OS control. Could be considered a useful feature for making kiosks interface.
Yes, a lot of gamepads are easy to figure out the mapping. If you put the polling on "bits" instead of decimal, and look at each bit of the bytes coming in, you'll find that each button corresponds to a single bit in one of the bytes coming in. Directional "DPad" rockers are "Nybles" (Half a byte or 4 bits of a Byte), with an 8 direction clock wise sequence that goes from 0=north 1=northeast 2=east etc. up to 7 (with 8 or 16 if no direction is pushed). Analog sticks send one signed byte X, and one signed byte Y (in decimal -127 to 127,-127 to 127). The Sony Dual Shock 4 controllers L1 & R1 "Triggers" buttons also send 2 bytes on the end that correspond to how far in the trigger is squeezed.capellan wrote: ↑Tue Apr 13, 2021 2:32 amUsing a broken gamepad, I tested again and found with surprise
that every gamepad button works fine.
This gamepad generates a string of 8 numbers but only 1 or 2
actually change after pressing a button.
Number values are just one of these 3 numbers: 255, 128, 0
Vendor name is Honey Bee identified with ID 1A5C
https://www.flipkart.com/genius-maxfire ... z9czk5g4yp
Al
Fun stuff.
Once all the controller's bytes are mapped out with a string telling it how to parse the bytes for a particular controller, then you can save that string that corresponds to VendorID & DeviceID and you can reload it later.
Re: USB Device - HIDAPI or ?
Today, I borrowed another gamepad: Vendor ID 0079 - Manufacturer: Microntek
All buttons of this new gamepad actually works.
The brand is Agiler Model: AGI-4010
https://www.agiler.us/?product=usb-2-0-gamepad
Did all gamepads always send a "No Input" string?
All buttons of this new gamepad actually works.
The brand is Agiler Model: AGI-4010
https://www.agiler.us/?product=usb-2-0-gamepad
Did all gamepads always send a "No Input" string?
-
- Posts: 627
- Joined: Wed Apr 24, 2013 4:53 pm
- Contact:
Re: USB Device - HIDAPI or ?
Cool, all HID USB gamepads should work at least for RAW input (unlike SONY & NINTENDO's controllers, Microsoft X-Box controllers are not HID and so need a driver). Are you using one of the Playstation controller "profiles" strings I set up in the demo stack?capellan wrote: ↑Thu Apr 15, 2021 1:50 amToday, I borrowed another gamepad: Vendor ID 0079 - Manufacturer: Microntek
All buttons of this new gamepad actually works.
The brand is Agiler Model: AGI-4010
https://www.agiler.us/?product=usb-2-0-gamepad
I'm confused, I thought you just said it worked?
If it's an USB or BT HID device that's properly connected to the the OS, and you pasted in the system path of the device in the "paste system path here" field, then when you start one of the polling loop buttons on the demo stack you should start receiving input from the device.
Re: USB Device - HIDAPI or ?
Hi Paul,
Yes, it worked great!
This misunderstanding it's my own mistake.
I am calling "NO INPUT STRING" to the hexadecimal string
produced by the gamepad when is connected, but no function
button, analog button or direction button is pressed.
Here I will post the codes for the two gamepads that tested.
Yes, it worked great!
This misunderstanding it's my own mistake.
I am calling "NO INPUT STRING" to the hexadecimal string
produced by the gamepad when is connected, but no function
button, analog button or direction button is pressed.
Here I will post the codes for the two gamepads that tested.
Last edited by capellan on Sat Jan 22, 2022 3:39 am, edited 1 time in total.
Re: USB Device - HIDAPI or ?
These are the codes for the discontinued Genius gamepad:
Last edited by capellan on Sat Jan 22, 2022 3:35 am, edited 1 time in total.
-
- Posts: 627
- Joined: Wed Apr 24, 2013 4:53 pm
- Contact:
Re: USB Device - HIDAPI or ?
That info (translated from hex to decimal) is basically all that's needed to make parsing string for my polling script.
I haven't worked on this lately because I've been working on several widgets that are sort-of spin-offs from working on the GUI for the demo stack for this. One of these spin-offs has turned into another major project (which I had sort-of planned long ago)... I will get back to this project eventually.
Re: USB Device - HIDAPI or ?
Great! Many thanks for making this project, Paul!
Could this LCB works with two or more gamepads
at the same time?
Could this LCB works with two or more gamepads
at the same time?
-
- Posts: 627
- Joined: Wed Apr 24, 2013 4:53 pm
- Contact:
Re: USB Device - HIDAPI or ?
You're welcome!
"Sort-of" I guess is the answer to that question. The way the LCB lib is currently set-up, you would just have to poll the devices one after the other, but LC could probably do it fast enough that it would seem like the "same time" from the end user's persepctive. I do plan to add something in that vein to the LCB when I add the pre-parsing of the incoming data based on that byte/bit description string. It will never really be "same time" but hopefully it will be not-a-noticeable amount-of-time-in-between.
Re: USB Device - HIDAPI or ?
Great! Thanks a lot again.
Your MIDI Player works great too.
Now, I have to find a way to use
the Analog Sticks to send MIDI
messages.
Your MIDI Player works great too.
Now, I have to find a way to use
the Analog Sticks to send MIDI
messages.