Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi,

I am writing a lua script for my Saitek Proflight modules.

Win10 + MSFS + FSUIPC 7.3.7 (registred).

Everything works perfectly for the Switch Panel, for the Multi Panel and for the Radio Panel, except this message :

   391500 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   391813 **** DevCom Read thread terminated
   392313 **** DevCom read/write threads still running - will exit anyway but could cause issues...

Same message for all Panel, but this does not disturb the operation.
I can read the buttons, and display the values in the screens (alt, speed ...).
Is this error message important?

I have a big problem with the BIP :

The "com.writefeature" always return "0" and nothing happens on the BIP.

Here is a test script :

Vendor = 0x06A3
Product1 = 0x0B4E    --  BIP
Product2 = 0x0D67    -- Switch Panel
Device = 0
Report = 0

ipc.log ("===========================  BIP   =========")
dev1, rd1, wrf1, wr1, init1 = com.openhid (Vendor, Product1, Device, Report)

ipc.log ( "================================ dev1 = " .. dev1)
ipc.log ( "================================ rd1 = " .. rd1)
ipc.log ( "================================ wrf1 = " .. wrf1)
ipc.log ( "================================ wr1 = " .. wr1)

s = string.char (6 , 2 , 2 , 2, 0 , 0 , 0 )
n = com.writefeature (dev1, s, wrf1)
ipc.log ("===========================  BIP writefeature  ==== n = " .. n)

ipc.log ("===========================  Switch module   =========")
dev2, rd2, wrf2, wr2, init21 = com.openhid (Vendor, Product2, Device, Report)

ipc.log ( "================================ dev2 = " .. dev2)
ipc.log ( "================================ rd2 = " .. rd2)
ipc.log ( "================================ wrf2 = " .. wrf2)
ipc.log ( "================================ wr2 = " .. wr2)

s = string.char (0 , 7)
n = com.writefeature (dev2, s, wrf2)
ipc.log ("===========================  Switch module writefeature  ==== n = " .. n)

com.close (dev1)
com.close (dev2)
	

Here is the log

********* LUA: "Poll_Saitek" Log [from FSUIPC version 7.3.7] *********
   357282 System time = 23/08/2022 13:19:52, Simulator time = 13:07:10 (11:07Z)
   357282 LUA: beginning "C:\FSUIPC7\Poll_Saitek.lua"
   357282 LUA: C:\FSUIPC7\Poll_Saitek.lua:1
   357297 LUA: Global: ipcPARAM = 0
   357313 LUA: C:\FSUIPC7\Poll_Saitek.lua:2
   357328 LUA: Global: Vendor = 1699
   357344 LUA: C:\FSUIPC7\Poll_Saitek.lua:3
   357360 LUA: Global: Product1 = 2894
   357375 LUA: C:\FSUIPC7\Poll_Saitek.lua:4
   357391 LUA: Global: Product2 = 3431
   357407 LUA: C:\FSUIPC7\Poll_Saitek.lua:5
   357422 LUA: Global: Device = 0
   357438 LUA: C:\FSUIPC7\Poll_Saitek.lua:7
   357453 LUA: Global: Report = 0
   357469 LUA: ===========================  BIP   =========
   357485 LUA: C:\FSUIPC7\Poll_Saitek.lua:8
   357594 LUA: C:\FSUIPC7\Poll_Saitek.lua:10
   357610 LUA: Global: dev1 = 1
   357625 LUA: Global: rd1 = 0
   357641 LUA: Global: wrf1 = 7
   357657 LUA: Global: wr1 = 0
   357672 LUA: ================================ dev1 = 1
   357688 LUA: C:\FSUIPC7\Poll_Saitek.lua:11
   357703 LUA: ================================ rd1 = 0
   357719 LUA: C:\FSUIPC7\Poll_Saitek.lua:12
   357735 LUA: ================================ wrf1 = 7
   357750 LUA: C:\FSUIPC7\Poll_Saitek.lua:13
   357766 LUA: ================================ wr1 = 0
   357782 LUA: C:\FSUIPC7\Poll_Saitek.lua:15
   357797 LUA: C:\FSUIPC7\Poll_Saitek.lua:16
   357813 LUA: Global: s = 
   357828 LUA: C:\FSUIPC7\Poll_Saitek.lua:17
   357844 LUA: Global: n = 0
   357860 LUA: ===========================  BIP writefeature  ==== n = 0
   357875 LUA: C:\FSUIPC7\Poll_Saitek.lua:19
   357891 LUA: ===========================  Switch module   =========
   357907 LUA: C:\FSUIPC7\Poll_Saitek.lua:20
   357953 LUA: C:\FSUIPC7\Poll_Saitek.lua:22
   357969 LUA: Global: rd2 = 4
   357985 LUA: Global: dev2 = 2
   358000 LUA: Global: wrf2 = 2
   358016 LUA: Global: wr2 = 0
   358032 LUA: ================================ dev2 = 2
   358047 LUA: C:\FSUIPC7\Poll_Saitek.lua:23
   358063 LUA: ================================ rd2 = 4
   358078 LUA: C:\FSUIPC7\Poll_Saitek.lua:24
   358094 LUA: ================================ wrf2 = 2
   358110 LUA: C:\FSUIPC7\Poll_Saitek.lua:25
   358125 LUA: ================================ wr2 = 0
   358141 LUA: C:\FSUIPC7\Poll_Saitek.lua:27
   358157 LUA: C:\FSUIPC7\Poll_Saitek.lua:28
   358172 LUA: Global: s = 
   358188 LUA: C:\FSUIPC7\Poll_Saitek.lua:29
   358203 LUA: Global: n = 2
   358219 LUA: ===========================  Switch module writefeature  ==== n = 2
   358235 LUA: C:\FSUIPC7\Poll_Saitek.lua:31
   359032 LUA: C:\FSUIPC7\Poll_Saitek.lua:32
   359860 >>> Thread forced exit (ipc.exit or os.exit) <<<
   359860 System time = 23/08/2022 13:19:55, Simulator time = 13:07:13 (11:07Z)
********* LUA execution terminated: Log Closed *********


Do you have an idea of what is wrong ?
Thanks in advance.

Posted
14 minutes ago, michel78320 said:

Everything works perfectly for the Switch Panel, for the Multi Panel and for the Radio Panel, except this message :

   391500 **** DevCom read/write threads still running - will exit anyway but could cause issues...
   391813 **** DevCom Read thread terminated
   392313 **** DevCom read/write threads still running - will exit anyway but could cause issues...

Same message for all Panel, but this does not disturb the operation.
I can read the buttons, and display the values in the screens (alt, speed ...).
Is this error message important?

Not if everything is working - its just an informative message that indicates the devcom threads could not be closed on the first attempt. You can safely ignore these.

25 minutes ago, michel78320 said:

I have a big problem with the BIP :

The "com.writefeature" always return "0" and nothing happens on the BIP.
...

Do you have an idea of what is wrong ?
 

No - I don't have any experience with the saitek BIP, sorry.

John

Posted

thank you for your answer.

Can you explain to me what is the number returned by "com.writefeature"   ?
Is it sent by the device?

By the way, com.writefeature does not use "wrf"
With Switch Panel, wrf = 2

s = string.char (0 , 3 , 2 , 2, 0 , 0 , 0 )
n = com.writefeature (dev1, s, 1)

returns n=2 ! and two leds light up (correct)

Posted
On 8/23/2022 at 2:26 PM, michel78320 said:

Can you explain to me what is the number returned by "com.writefeature"   ?
Is it sent by the device?

It is as documented: The returned value gives the number of bytes actually sent (or at least, placed in the buffer).

On 8/23/2022 at 2:26 PM, michel78320 said:

By the way, com.writefeature does not use "wrf"
With Switch Panel, wrf = 2

s = string.char (0 , 3 , 2 , 2, 0 , 0 , 0 )
n = com.writefeature (dev1, s, 1)

returns n=2 !

The com.writefeature function just passes through to the windows HidD_SetFeature function. There are some 'correct size' checks and the passed in size may be adjusted - you can skip this parameter and the correct size should be used (I think!). The returned value will be what was actually written to the device' buffer.

You could try logging HID activity to see what is happening. From the Log->Custom menu, enter 0x200. This should then log all HID activity.

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
×
×
  • 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.