Jump to content
Sign in to follow this  
MarkDH

LINDA joystick ids vs. FSUIPC joystick numbers?

Recommended Posts

Can someone explain to me the relationship between LINDA's joystick ids and the joystick numbers in FSUIPC4.ini? Given the LINDA joystick id, can I find the FSUIPC id? I am working on a way to synchronise my aircraft with my cockpit switches and so far I am one step short. Having poked around in the LINDA code I discovered I can enumerate all my bound functions like this:

for Stick, v in pairs(JSTK) do
    ipc.log("Joystick id: " .. Stick)
    for Button = 1, 32, 1 do
        local Funct = JSTK[Stick][Button]
        if Funct ~= nil then
            ipc.log("    button " .. tostring(Button) .. ": " .. tostring(Funct))
        end
    end
end

 This produces output like this (partial):

LUA.1: Joystick id: 06A30D050
LUA.1:     button 16: ADF_FRQ
LUA.1:     button 21: ADF_Inner_Knob_Right
LUA.1:     button 22: ADF_Inner_Knob_Left
LUA.1:     button 23: ADF_Outer_Knob_Right
LUA.1:     button 24: ADF_Outer_Knob_Left
LUA.1: Joystick id: 1DD210010
LUA.1:     button 1: TW_AP_Pitch_thumbknob_dn
LUA.1:     button 2: TW_AP_Bank_thumbknob_left
LUA.1:     button 3: TW_AP_Yaw_toggle
LUA.1:     button 4: RXP_Nav_Device_Swap
LUA.1:     button 5: Parking_Brake_ON
LUA.1:     button 6: TW_AP_Bank_thumbknob_right
LUA.1:     button 7: Flight_Data_Recorder_ON
LUA.1:     button 8: Aileron_Trim_Left
LUA.1:     button 9: TW_DC_Source_sw_Ext
LUA.1:     button 11: Lights_LANDING_on
LUA.1:     button 12: Ign_Mode_Sw_manual
LUA.1:     button 13: Lights_LANDING_on
LUA.1:     button 15: Starter_Sw_left
LUA.1:     button 17: Ign_Eng1_Sw_1
LUA.1:     button 18: Ign_Eng2_Sw_1
LUA.1:     button 19: Mod_ADF_Power_on
LUA.1:     button 20: GNS530_MENU
LUA.1:     button 21: GNS530_Power_ON
LUA.1:     button 22: ADF_SET_RST_Down
LUA.1:     button 23: DME_Mode_RMT
LUA.1:     button 24: GNS530_Decrease_Range
LUA.1:     button 25: GNS530_Increase_Range
LUA.1:     button 26: SPK_COM1_ON
LUA.1:     button 27: ADF_FRQ
LUA.1:     button 28: ADF_FLT_ET
LUA.1:     button 29: GNS530_Direct_To
LUA.1:     button 30: TW_AP_Pitch_thumbknob_up
LUA.1:     button 31: GNS530_Panel_Drives_RXP
LUA.1:     button 32: Flight_Data_Recorder_Test_DOWN
...etc.

I have also found I can call these functions like so:

buttonExecute("1DD210010", JSTK["1DD210010"][5])  -- Sets the parking brake

BUT what I now want to do is traverse this list and check the positions of the buttons and switches, and then call the functions for switches that are set. If I was just doing it for the parking brake switch:

Button = 5
if ipc.testbutton(WHAT?, Button - 1) then            -- If the parking brake switch is set
    buttonExecute(WHAT?, JSTK["1DD210010"][Button])  -- Make sure the parking brake is actually ON
end

So you can see I don't know how to get the FSUIPC number I need to interrogate the button. There must be a 1:1 correspondence here between the LINDA and FSUIPC ids and I am assuming this must be stored somewhere. I am buggered if I can figure out where!


MarkH

gGzCVFp.jpg
Core i7-7700K / 32Gb DDR4 / Gigabyte GTX1070 / 1080p x 3 x weird / Win7 64 Pro

Share this post


Link to post
Share on other sites

Hi Mark

 

LINDA identifies HID devices (ie. joysticks) by the Vendor and Product IDs read from the device to form the ID and adds a suffix number if it finds multiple devices.  Therefore, the Device you quote has the VID 1DD2 and the PID 1001 and is the first device of that type found (0) giving 1DD210010.  This is done independent of FSUIPC4 but will be linked by these data.

 

I would need to study your code to see what you are trying to do.  I don't have time at the moment.


Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

Share this post


Link to post
Share on other sites

LINDA identifies HID devices (ie. joysticks) by the Vendor and Product IDs read from the device to form the ID and adds a suffix number if it finds multiple devices.  Therefore, the Device you quote has the VID 1DD2 and the PID 1001 and is the first device of that type found (0) giving 1DD210010.  This is done independent of FSUIPC4 but will be linked by these data.

 

Eek, don't worry for now as I have just discovered that the COM library has been extended to manipulate HIDs since I printed my FSUIPC documentation! At first glance I am hopeful I will be able to do what I need with those functions with the VID and PID.


MarkH

gGzCVFp.jpg
Core i7-7700K / 32Gb DDR4 / Gigabyte GTX1070 / 1080p x 3 x weird / Win7 64 Pro

Share this post


Link to post
Share on other sites

COM library

 

Yes, that did it, I now have my aircraft synchronising with the state of my switches!


MarkH

gGzCVFp.jpg
Core i7-7700K / 32Gb DDR4 / Gigabyte GTX1070 / 1080p x 3 x weird / Win7 64 Pro

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...