Jump to content
The simFlight Network Forums

Input from buttons 32-127 not recognized


szeliga90
 Share

Recommended Posts

Hi. I'm in the process of building custom game controller based on Arduino Leonardo. Some time ago I reported that FSUIPC can't see it because the HID is not of a type "Joystick". I though no problem I just gonna use vJoy instead and wrote one to one re-mapper from my Arduino HID to vJoy HID. That does work but only for the first 32 buttons (0 to 31). Input from buttons 32 to 127 is not recognized by FSUIPC although it definitely work because I can use it if mapped directly within MSFS. 

Is that something what should work? Or is it expected behavior for FSUIPC to be able to work only with first 32 buttons of the controller? In theory I could always remap my 2x Arduino HID 128 buttons each into 8 vJoy HID 32 buttons each but that would make entire process even more messy that already is so If possible I would prefer to avoid that.

Please see HID scans of the vJoy devices below:

**************************************************************************

  Device at "\\?\hid#hidclass&col01#1&2d595ca7&1&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"
  Vendor=1234, Product=BEAD (Version 2.25)
  Manufacturer= Shaul Eizikovich
  Product= vJoy - Virtual Joystick
  Serial Number= 2.1.9
  Usage Page: 1
  Input Report Byte Length: 65
  Output Report Byte Length: 0
  Feature Report Byte Length: 0
  Number of Link Collection Nodes: 2
  Number of Input Button Caps: 1
  Number of InputValue Caps: 12
  Number of InputData Indices: 140
  Number of Output Button Caps: 0
  Number of Output Value Caps: 0
  Number of Output Data Indices: 0
  Number of Feature Button Caps: 0
  Number of Feature Value Caps: 0
  Number of Feature Data Indices: 0
  Buttons range 1 -> 128 at indices 12 -> 139
  Value X at index 0, range 0 -> 32767, using 32 bits
  Value Y at index 1, range 0 -> 32767, using 32 bits
  Value Z at index 2, range 0 -> 32767, using 32 bits
  Value U/RX at index 3, range 0 -> 32767, using 32 bits
  Value V/RY at index 4, range 0 -> 32767, using 32 bits
  Value R/RZ at index 5, range 0 -> 32767, using 32 bits
  Value Sldr at index 6, range 0 -> 32767, using 32 bits
  Value Dial at index 7, range 0 -> 32767, using 32 bits
  Value POV at index 8, range 0 -> 35900, using 32 bits
  Value POV at index 9, range 0 -> 35900, using 32 bits
  Value POV at index 10, range 0 -> 35900, using 32 bits
  Value POV at index 11, range 0 -> 35900, using 32 bits
  **************************************************************************

  Device at "\\?\hid#hidclass&col02#1&2d595ca7&1&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}"
  Vendor=1234, Product=BEAD (Version 2.25)
  Manufacturer= Shaul Eizikovich
  Product= vJoy - Virtual Joystick
  Serial Number= 2.1.9
  Usage Page: 1
  Input Report Byte Length: 65
  Output Report Byte Length: 0
  Feature Report Byte Length: 0
  Number of Link Collection Nodes: 2
  Number of Input Button Caps: 1
  Number of InputValue Caps: 12
  Number of InputData Indices: 140
  Number of Output Button Caps: 0
  Number of Output Value Caps: 0
  Number of Output Data Indices: 0
  Number of Feature Button Caps: 0
  Number of Feature Value Caps: 0
  Number of Feature Data Indices: 0
  Buttons range 1 -> 128 at indices 12 -> 139
  Value X at index 0, range 0 -> 32767, using 32 bits
  Value Y at index 1, range 0 -> 32767, using 32 bits
  Value Z at index 2, range 0 -> 32767, using 32 bits
  Value U/RX at index 3, range 0 -> 32767, using 32 bits
  Value V/RY at index 4, range 0 -> 32767, using 32 bits
  Value R/RZ at index 5, range 0 -> 32767, using 32 bits
  Value Sldr at index 6, range 0 -> 32767, using 32 bits
  Value Dial at index 7, range 0 -> 32767, using 32 bits
  Value POV at index 8, range 0 -> 35900, using 32 bits
  Value POV at index 9, range 0 -> 35900, using 32 bits
  Value POV at index 10, range 0 -> 35900, using 32 bits
  Value POV at index 11, range 0 -> 35900, using 32 bits
  **************************************************************************

 

Link to comment
Share on other sites

25 minutes ago, szeliga90 said:

Or is it expected behavior for FSUIPC to be able to work only with first 32 buttons of the controller?

This is the expected behavior and is due to the windows API being used only supporting the first 32 buttons (0-31).

However, a  lua plugin can be used to read and process  (best sent to "virtual  buttons" for assignment) all buttons. There is an example provided in the lua examples zip (provided with FSUIPC4/5/6) called "HidDemo.lua". That handles many axes and up to 256 buttons on a device, mapping them to "virtual buttons" in FSUIPC which will be seen in the Buttons & Switches tab and can be assigned there.

All you should have to do is change these two lines:

Vendor = 0x16C0
Product = 0x05B5

John

Lua example attached:

HidDemo.lua

Edited by John Dowson
Lua file added
Link to comment
Share on other sites

Hi John. 

I downloaded the FSUIPC4 installer unfortunately I can't install it as I currently don't have FSX and I would prefer not to download it just for the purpose of installing FSUIPC4 to get one file out of it. I am a FSUIPC4 owner. I bough it in Jan 2016 from simmarket. If there is any way I could prove you that I did purchase it, I'm happy to do so. I just wonder would it be possible to get the HidDemo.lua file directly from you? 

Or am I getting this wrong and I don't have to install FSUIPC4 the lua examples are available somewhere to download and I just can't find it?

Link to comment
Share on other sites

1 hour ago, szeliga90 said:

I just gonna use vJoy instead and wrote one to one re-mapper from my Arduino HID to vJoy HID. That does work but only for the first 32 buttons (0 to 31). Input from buttons 32 to 127 is not recognized by FSUIPC although it definitely work because I can use it if mapped directly within MSFS. 

You could use 4 virtual joysticks (vJoy supports up to 16) to get 128 buttons mapped.

Pete

 

Link to comment
Share on other sites

I have no experience with LUA. Where the lua script should be located?

Following the manual I:

- modified the data of the Honeycomb Alpha Yoke in the demo lua script:

Vendor = 0x294B
Product = 0x1900

- added the script to the FSUIPC ini:

[Auto]
1=HidDemo

I placed the HidDemo.lua in the same folder as FSUIPC7

To be honest I have no idea how to make the lua script running. And how to access the virtual buttons in the FSUIPC7 interface.

Link to comment
Share on other sites

It works now, but it's a bit erratic. What I'm trying to achieve is to assign Magneto L, BOTH, START switch postions of the Honeycomb Alpha Yoke (buttons 32, 33, 34).

Whenever I change the position of any switch (or press a button) on the Apha Yoke below 32 switch/button limit it registers twice in the FSUIPC button UI:

- as "original" button (without LUA) - "C" joystick

- as "virtual" button (via LUA) - "65" jotstick

Is the are way to mask in the lua script all the axes and the buttons below 32 and present as virtual switches only the 3 magneto switch positions, above the 32 button limit?

Here is the relevant part of my config:

[JoyNames]
0=Alpha Flight Controls
0.GUID={D27F6C30-CEB5-11EA-8001-444553540000}
1=3-osiowy 9-przyciskowy joystick
1.GUID={54A8FEA0-3755-11E9-8004-444553540000}
A=CH PRO PEDALS USB
A.GUID={7EB89080-F0D3-11E7-8001-444553540000}
B=3-osiowy 9-przyciskowy joystick
B.GUID={54A8FEA0-3755-11E9-8004-444553540000}
2=CH PRO PEDALS USB
2.GUID={7EB89080-F0D3-11E7-8001-444553540000}
C=Alpha Flight Controls
C.GUID={D27F6C30-CEB5-11EA-8001-444553540000}

[Buttons]
PollInterval=25
ButtonRepeat=20,10
1=PC,12,Cx01003102,x01     -{offset byte set, offset 3102}-
2=PC,13,Cx01003102,x00     -{offset byte set, offset 3102}-
3=PC,14,Cx01003101,x01     -{offset byte set, offset 3101}-
4=PC,15,Cx01003101,x00     -{offset byte set, offset 3101}-
6=PC,21,Cx01003125,x00     -{offset byte set, offset 3125}-
7=PC,20,Cx01003125,x01     -{offset byte set, offset 3125}-
8=PC,22,C66701,1     -{AVIONICS_MASTER_SET}-
9=PC,23,C66701,0     -{AVIONICS_MASTER_SET}-
10=PC,24,C66072,0     -{PITOT_HEAT_ON}-
11=PC,25,C66073,0     -{PITOT_HEAT_OFF}-
12=PC,26,Cx010008B2,x01     -{offset byte set, offset 08B2}-
13=PC,27,Cx010008B2,x00     -{offset byte set, offset 08B2}-
14=PC,28,C66052,0     -{STROBES_ON}-
15=PC,29,C66053,0     -{STROBES_OFF}-
16=PC,30,C66023,0     -{MAGNETO_OFF}-
17=PC,31,C66024,0     -{MAGNETO_RIGHT}-
18=PC,16,C65958,0     -{FUEL_SELECTOR_RIGHT}-
19=PC,17,C65957,0     -{FUEL_SELECTOR_LEFT}-
20=PB,0,C66059,0     -{LANDING_LIGHTS_ON}-
21=PB,1,C66060,0     -{LANDING_LIGHTS_OFF}-
22=PB,2,Cx05000D0C,x01     -{offset byte setbits, offset 0D0C}-
23=PB,3,Cx09000D0C,x01     -{offset byte clrbits, offset 0D0C}-
24=PB,4,Cx05000D0C,x08     -{offset byte setbits, offset 0D0C}-
25=PB,5,Cx09000D0C,x08     -{offset byte clrbits, offset 0D0C}-
26=RC,5,C65607,0     -{ELEV_TRIM_DN}-
27=RC,4,C65615,0     -{ELEV_TRIM_UP}-
28=RC,9,C65879,0     -{HEADING_BUG_INC}-
29=RC,8,C65880,0     -{HEADING_BUG_DEC}-
30=RC,7,C65892,0     -{AP_ALT_VAR_INC}-
31=RC,6,C65893,0     -{AP_ALT_VAR_DEC}-
33=P65,0,C66025,0     -{MAGNETO_LEFT}-
34=P65,1,C66026,0     -{MAGNETO_BOTH}-
35=P65,2,C66027,0     -{MAGNETO_START}-

 

Edited by Steku2
Link to comment
Share on other sites

26 minutes ago, Steku2 said:

Is the are way to mask in the lua script all the axes and the buttons below 32 and present as virtual switches only the 3 magneto switch positions, above the 32 button limit?

Sure. You can remove the axis processing stuff (and the logging if you don't need that), and only write the buttons you need here:
                ipc.writeUD(0x3340 + ((i-1) * 4), buttons)
However, buttons are written 32 at a time (8 x 32 but words). You can ignore the first 32 buttons by not writing there when i=0, or just write buttons 32-64 when i=1.

Try modifying yourself, but if you have any problems I can take a look tomorrow for you.

Link to comment
Share on other sites

Thank you very much. 

Your adapted script wasn't functional initially, but I added:

buttons = {}

and now it works for the buttons above 0-31, exactly what I needed to handle Honeycomb Alpha Yoke Magneto multiposition switch. No longer chasing the buttons on screen with mouse! Let's hope Asobo will soon fix simconnect.

Years ago, when I was building my H/W panel for FSX, I wouldn't be possible without FSUIPC. New sim arrived, but only with FSUIPC it can be really useful. Thank you for this wonderful piece of software and first-class support!

 

HidButtons32-39.lua

Link to comment
Share on other sites

  • 3 months later...

I, too, am trying to use FSUIPC7 to map the buttons on an Alpha yoke for MSFS 2020, and to overcome the issues with the magneto multi-position switch. I've used XPUIPC and lua files in X-plane previously, but not in MSFS.

I've downloaded the lua file that Steku2 very helpfully provided. I've checked, and perhaps unsurprisingly, the vendor and product codes are the same as mine, as shown by HidScanner.

I've put the lua file in the FSUIPC7 directory. However, the last 3 positions on the magneto switch are still not recognised in the FSUIPC7 button mapping.

Any idea what I might be doing wrong?

many thanks

Paul

Link to comment
Share on other sites

Thanks John

Perhaps I'm being very thick, but I can't see anything on p.40 of either the User Guide, or the Advanced Guide that deals with this?

My FSUIPC7.ini file includes [Auto] and [Lua] sections, with the lua file name that is in the FSUIPC7 directory. You don't mean copying and pasting the contents of the lua file directly into the  FSUIPC7.ini file, do you?

Paul

Link to comment
Share on other sites

6 minutes ago, paulferris1964 said:

Perhaps I'm being very thick, but I can't see anything on p.40 of either the User Guide, or the Advanced Guide that deals with this?

Sorry, its P40 in the FSUIPC6 User Guide, for FSUIPC7 its on p35, section entitled Automatic running of Macros or Lua plugins.

8 minutes ago, paulferris1964 said:

My FSUIPC7.ini file includes [Auto] and [Lua] sections, with the lua file name that is in the FSUIPC7 directory.

Ok, so you have already added the Lua to the [Auto] section (and in the correct format, as described in the manual)?
If so, and its not working, you can activate logging for Lua Plugins and check your log to see if it is running and if there are any errors. You can also post it here and I'll take a look (with your FSUIPC7.ini file as well please).

John

Link to comment
Share on other sites

8 minutes ago, paulferris1964 said:

Perhaps I'm being very thick, but I can't see anything on p.40 of either the User Guide, or the Advanced Guide that deals with this?

On my copy, Page 35 of the Advanced Users guide has a section entitled

Automatic running of Macros and Lua plugins

with instructions and examples. Do you have some sort of corrupted install? 

Also there are explicit instructions in this thread! Did you not read it first before adding to it? Look about 6 posts above your first post.

Pete

 

Link to comment
Share on other sites

  • 1 month later...

I followed the directions from this post:

https://forum.simflight.com/topic/91617-a-step-by-step-for-fsuipc7-honeycomb-alpha-yoke-and-msfs2020/

Still not getting the last 3 switches showing in FSUIPC7.  My copy of hidAlphaButtons.lua is in my FSUIPC7 directory.

 

Thanks

Andrew

 

 

FSUIPC7.ini FSUIPC7.log hidAlphaButtons.lua

Link to comment
Share on other sites

1 hour ago, Andrew Smith said:

I followed the directions from this post:

https://forum.simflight.com/topic/91617-a-step-by-step-for-fsuipc7-honeycomb-alpha-yoke-and-msfs2020/

Still not getting the last 3 switches showing in FSUIPC7.  My copy of hidAlphaButtons.lua is in my FSUIPC7 directory.

Could you ask in that forum post - the author does say:

Quote

And please.. if there is a problem anywhere in my instructions... drop me a note and I'll try to duplicate your problem and fix this post.

But you can remove the hidBravpButtons.lua script (and [Auuto] entry) if you are not using a Bravo.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.