norberttak / XPanel

XPlane 11/12 plugin to handle home cockpit panels
GNU General Public License v3.0
8 stars 3 forks source link

[BUG] hid_send_feature_report error on Gentoo Linux #90

Closed CyberGuerro closed 3 months ago

CyberGuerro commented 4 months ago

Describe the bug With attached xpanel.ini and Saitek Radio Panel connected to USB, plugin crash and x-plane with it

To Reproduce Steps to reproduce the behavior like this:

  1. Attach saitek device
  2. Run X-Plane12 and select aircraft (ZIBO 4.01.9)
  3. Start flight
  4. X-Plane crash

Expected behavior Flight start

X-Plane log file Log.txt

xpanel.ini content:

; Aircraft specific handler for Zibo 737 XPlane aircraft
log_level="DEBUG"
aircraft_acf="b738_4k.acf"

;---------------------- Saitek Radio Panel -------------------------
[device:id="saitek_radio"]
vid="6a3"
pid="d05"

[multi_display:id="RADIO_DISPLAY_ACTIVE_UP"]
line="on_select:SW_UP_COM1,dataref:sim/cockpit/radios/com1_freq_hz"
line="on_select:SW_UP_COM2,dataref:sim/cockpit/radios/com2_freq_hz"
line="on_select:SW_UP_NAV1,dataref:sim/cockpit/radios/nav1_freq_hz"
line="on_select:SW_UP_NAV2,dataref:sim/cockpit/radios/nav2_freq_hz"
line="on_select:SW_UP_ADF,dataref:sim/cockpit/radios/adf1_freq_hz"
line="on_select:SW_UP_IDT,dataref:sim/cockpit/radios/transponder_code"

[multi_display:id="RADIO_DISPLAY_STBY_UP"]
line="on_select:SW_UP_COM1,dataref:sim/cockpit/radios/com1_stdby_freq_hz"
line="on_select:SW_UP_COM2,dataref:sim/cockpit/radios/com2_stdby_freq_hz"
line="on_select:SW_UP_NAV1,dataref:sim/cockpit/radios/nav1_stdby_freq_hz"
line="on_select:SW_UP_NAV2,dataref:sim/cockpit/radios/nav2_stdby_freq_hz"
line="on_select:SW_UP_ADF,dataref:sim/cockpit/radios/adf1_stdby_freq_hz"

[button:id="KNOB_UP_BIG_PLUS"]
on_push="on_select:SW_UP_COM1,dataref:sim/cockpit/radios/com1_stdby_freq_hz:100:0:15000"
on_push="on_select:SW_UP_COM2,dataref:sim/cockpit/radios/com2_stdby_freq_hz:100:0:15000"
on_push="on_select:SW_UP_NAV1,dataref:sim/cockpit/radios/nav1_stdby_freq_hz:100:0:15000"
on_push="on_select:SW_UP_NAV2,dataref:sim/cockpit/radios/nav2_stdby_freq_hz:100:0:15000"
on_push="on_select:SW_UP_ADF,dataref:sim/cockpit/radios/adf1_stdby_freq_hz:100:0:359"
on_push="on_select:SW_UP_IDT,dataref:sim/cockpit/radios/transponder_code:100:0:8888"

[button:id="KNOB_UP_BIG_MINUS"]
on_push="on_select:SW_UP_COM1,dataref:sim/cockpit/radios/com1_stdby_freq_hz:-100:0:16000"
on_push="on_select:SW_UP_COM2,dataref:sim/cockpit/radios/com2_stdby_freq_hz:-100:0:16000"
on_push="on_select:SW_UP_NAV1,dataref:sim/cockpit/radios/nav1_stdby_freq_hz:-100:0:16000"
on_push="on_select:SW_UP_NAV2,dataref:sim/cockpit/radios/nav2_stdby_freq_hz:-100:0:16000"
on_push="on_select:SW_UP_ADF,dataref:sim/cockpit/radios/adf1_stdby_freq_hz:-100:0:359"
on_push="on_select:SW_UP_IDT,dataref:sim/cockpit2/radios/actuators/transponder_code:-100:0:8888"

[button:id="KNOB_UP_SMALL_PLUS"]
on_push="on_select:SW_UP_COM1,dataref:sim/cockpit/radios/com1_stdby_freq_hz:5:0:15000"
on_push="on_select:SW_UP_COM2,dataref:sim/cockpit/radios/com2_stdby_freq_hz:5:0:15000"
on_push="on_select:SW_UP_NAV1,dataref:sim/cockpit/radios/nav1_stdby_freq_hz:1:0:15000"
on_push="on_select:SW_UP_NAV2,dataref:sim/cockpit/radios/nav2_stdby_freq_hz:1:0:15000"
on_push="on_select:SW_UP_ADF,dataref:sim/cockpit/radios/adf1_stdby_freq_hz:1:0:359"
on_push="on_select:SW_UP_IDT,dataref:sim/cockpit/radios/transponder_code:1:0:8888"

[button:id="KNOB_UP_SMALL_MINUS"]
on_push="on_select:SW_UP_COM1,dataref:sim/cockpit/radios/com1_stdby_freq_hz:-5:0:16000"
on_push="on_select:SW_UP_COM2,dataref:sim/cockpit/radios/com2_stdby_freq_hz:-5:0:16000"
on_push="on_select:SW_UP_NAV1,dataref:sim/cockpit/radios/nav1_stdby_freq_hz:-1:0:16000"
on_push="on_select:SW_UP_NAV2,dataref:sim/cockpit/radios/nav2_stdby_freq_hz:-1:0:16000"
on_push="on_select:SW_UP_ADF,dataref:sim/cockpit/radios/adf1_stdby_freq_hz:-1:0:359"
on_push="on_select:SW_UP_IDT,dataref:sim/cockpit2/radios/actuators/transponder_code:-1:0:8888"

[button:id="ACT_STBY_UP"]
on_push="on_select:SW_UP_COM1,commandref:sim/radios/com1_standy_flip:once"
on_push="on_select:SW_UP_COM2,commandref:sim/radios/com2_standy_flip:once"
on_push="on_select:SW_UP_NAV1,commandref:sim/radios/nav1_standy_flip:once"
on_push="on_select:SW_UP_NAV2,commandref:sim/radios/nav2_standy_flip:once"
on_push="on_select:SW_UP_ADF,commandref:sim/radios/adf1_standy_flip:once"

[multi_display:id="RADIO_DISPLAY_ACTIVE_DOWN"]
line="on_select:SW_DOWN_COM1,dataref:sim/cockpit/radios/com1_freq_hz"
line="on_select:SW_DOWN_COM2,dataref:sim/cockpit/radios/com2_freq_hz"
line="on_select:SW_DOWN_NAV1,dataref:sim/cockpit/radios/nav1_freq_hz"
line="on_select:SW_DOWN_NAV2,dataref:sim/cockpit/radios/nav2_freq_hz"
line="on_select:SW_DOWN_ADF,dataref:sim/cockpit/radios/adf1_freq_hz"
line="on_select:SW_DOWN_IDT,dataref:sim/cockpit/radios/transponder_code"

[multi_display:id="RADIO_DISPLAY_STBY_DOWN"]
line="on_select:SW_DOWN_COM1,dataref:sim/cockpit/radios/com1_stdby_freq_hz"
line="on_select:SW_DOWN_COM2,dataref:sim/cockpit/radios/com2_stdby_freq_hz"
line="on_select:SW_DOWN_NAV1,dataref:sim/cockpit/radios/nav1_stdby_freq_hz"
line="on_select:SW_DOWN_NAV2,dataref:sim/cockpit/radios/nav2_stdby_freq_hz"
line="on_select:SW_DOWN_ADF,dataref:sim/cockpit/radios/adf1_stdby_freq_hz"

[button:id="KNOB_DOWN_BIG_PLUS"]
on_push="on_select:SW_DOWN_COM1,dataref:sim/cockpit/radios/com1_stdby_freq_hz:100:0:15000"
on_push="on_select:SW_DOWN_COM2,dataref:sim/cockpit/radios/com2_stdby_freq_hz:100:0:15000"
on_push="on_select:SW_DOWN_NAV1,dataref:sim/cockpit/radios/nav1_stdby_freq_hz:100:0:15000"
on_push="on_select:SW_DOWN_NAV2,dataref:sim/cockpit/radios/nav2_stdby_freq_hz:100:0:15000"
on_push="on_select:SW_DOWN_ADF,dataref:sim/cockpit/radios/adf1_stdby_freq_hz:100:0:359"
on_push="on_select:SW_DOWN_IDT,dataref:sim/cockpit/radios/transponder_code:100:0:8888"

[button:id="KNOB_DOWN_BIG_MINUS"]
on_push="on_select:SW_DOWN_COM1,dataref:sim/cockpit/radios/com1_stdby_freq_hz:-100:0:16000"
on_push="on_select:SW_DOWN_COM2,dataref:sim/cockpit/radios/com2_stdby_freq_hz:-100:0:16000"
on_push="on_select:SW_DOWN_NAV1,dataref:sim/cockpit/radios/nav1_stdby_freq_hz:-100:0:16000"
on_push="on_select:SW_DOWN_NAV2,dataref:sim/cockpit/radios/nav2_stdby_freq_hz:-100:0:16000"
on_push="on_select:SW_DOWN_ADF,dataref:sim/cockpit/radios/adf1_stdby_freq_hz:-100:0:359"
on_push="on_select:SW_DOWN_IDT,dataref:sim/cockpit2/radios/actuators/transponder_code:-100:0:8888"

[button:id="KNOB_DOWN_SMALL_PLUS"]
on_push="on_select:SW_DOWN_COM1,dataref:sim/cockpit/radios/com1_stdby_freq_hz:5:0:15000"
on_push="on_select:SW_DOWN_COM2,dataref:sim/cockpit/radios/com2_stdby_freq_hz:5:0:15000"
on_push="on_select:SW_DOWN_NAV1,dataref:sim/cockpit/radios/nav1_stdby_freq_hz:1:0:15000"
on_push="on_select:SW_DOWN_NAV2,dataref:sim/cockpit/radios/nav2_stdby_freq_hz:1:0:15000"
on_push="on_select:SW_DOWN_ADF,dataref:sim/cockpit/radios/adf1_stdby_freq_hz:1:0:359"
on_push="on_select:SW_DOWN_IDT,dataref:sim/cockpit/radios/transponder_code:1:0:8888"

[button:id="KNOB_DOWN_SMALL_MINUS"]
on_push="on_select:SW_DOWN_COM1,dataref:sim/cockpit/radios/com1_stdby_freq_hz:-5:0:16000"
on_push="on_select:SW_DOWN_COM2,dataref:sim/cockpit/radios/com2_stdby_freq_hz:-5:0:16000"
on_push="on_select:SW_DOWN_NAV1,dataref:sim/cockpit/radios/nav1_stdby_freq_hz:-1:0:16000"
on_push="on_select:SW_DOWN_NAV2,dataref:sim/cockpit/radios/nav2_stdby_freq_hz:-1:0:16000"
on_push="on_select:SW_DOWN_ADF,dataref:sim/cockpit/radios/adf1_stdby_freq_hz:-1:0:359"
on_push="on_select:SW_DOWN_IDT,dataref:sim/cockpit2/radios/actuators/transponder_code:-1:0:8888"

[button:id="ACT_STBY_DOWN"]
on_push="on_select:SW_DOWN_COM1,commandref:sim/radios/com1_standy_flip:once"
on_push="on_select:SW_DOWN_COM2,commandref:sim/radios/com2_standy_flip:once"
on_push="on_select:SW_DOWN_NAV1,commandref:sim/radios/nav1_standy_flip:once"
on_push="on_select:SW_DOWN_NAV2,commandref:sim/radios/nav2_standy_flip:once"
on_push="on_select:SW_DOWN_ADF,commandref:sim/radios/adf1_standy_flip:once"

List of usb devices connected before run X-Plane12

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 1462:7d25 Micro Star International MYSTIC LIGHT 
Bus 001 Device 003: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 006: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 001 Device 009: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 001 Device 010: ID 058f:6364 Alcor Micro Corp. AU6477 Card Reader Controller
Bus 001 Device 033: ID 043e:9a10 LG Electronics USA, Inc. ASM107x
Bus 001 Device 034: ID 131d:0159 Natural Point 
Bus 001 Device 041: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus 001 Device 042: ID 06a3:0d05 Saitek PLC Pro Flight Radio Panel
Bus 001 Device 043: ID 1a40:0101 Terminus Technology Inc. Hub
Bus 001 Device 044: ID 03f0:e807 HP, Inc HP Webcam HD 4310
Bus 001 Device 045: ID 046d:c52b Logitech, Inc. Unifying Receiver
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 005: ID 05e3:0616 Genesys Logic, Inc. hub

Desktop (please complete the following information):

norberttak commented 4 months ago

Thanks for the bug report. I've never seen a crash on that component. I have to investigate it and reproduce in my environment. Try to do this on the weekend.

CyberGuerro commented 4 months ago

I think I found a possible cause: I removed all your libraries to force plugin using my system libraries (hidapi, libusb), only liblua I had to maintain and now plugin start but return me this error:

XPanel [7052] [DEBUG]:add new saitek radio panel device
XPanel [7052] [DEBUG]:UsbHidDevice: call hid_init()
XPanel [13068] [DEBUG]:UsbHidDevice connect successful. vid=1699 pid=3333
XPanel [14070] [ERROR]:error in UsbHidDevice::send_feature_report reason=hid_error is not implemented yet
XPanel [14070] [ERROR]:SaitekRadioPanel connect. error in write_device
XPanel [14070] [DEBUG]:SaitekRadioPanel::start called
XPanel [14070] [DEBUG]:UsbHidDevice::start
XPanel [14070] [INFO]:successful init and start plugin

in my distribution hidapi is 0.13.1 (I tried 0.14 marked unstable but same error) I suspect that in your sistem (LINUX) you have more recent version and not all dependency libs was included in your installation package, so plugin try to search in my system's libs that apparently are incompatible with yours.

PS. Now I'm using compiled sources that you send me for bug #87, instead of official release sources (1.8)

norberttak commented 4 months ago

I tested your config on windows and it works fine. So I think the issue is around hidapi library versions. Unfortunately I don't have a Linux machine that can run XPlane (only a laptop to build the sources). Here you can see how the github action pipeline build the Linux binary: https://github.com/norberttak/XPanel/blob/439f28f76d6e9f8555a3f3d5638e216f4b56a05c/.github/workflows/build-and-test.yml#L61 The pipeline uses Ubuntu 20.04 (Focal) which is pretty old and it uses hidapi 0.9 version according to Ubuntu

On my Windows machine, I use the 0.12.0 version of hidapi lib and it works fine. I don't know whether it is possible to downgrade your hidapi version to this or not.

To solve the issue I have to update the hidapi version to the latest stable version (0.13.1 or 0.14) and do tests with that version on Windows and Linux. I guess the same error ("hid_error is not implemented yet") will raise on Windows as well.

CyberGuerro commented 4 months ago

Two little things/questions about pipeline build action:

  1. can you substitute liblua5.3-dev at line 64 with liblua-dev (without version, so it can take last installed version of it)?
  2. can you switch from focal to lunar or newer?

About hidapi on my system I've installed it to make some tests, but normally it isn't installed and the plugin uses its libraries installed in its folder like other plugins which are completely autoconsisten.

If I can help you I give you my time as tester. I tried to build your sources, but I haven't packages for arduino and compilation fails :-( :-(

norberttak commented 4 months ago

Regarding pipeline:

You can find the build artifacts here: https://github.com/norberttak/XPanel/actions/runs/8310493658/artifacts/1332243748

I updated the hidapi version to the latest 0.14.0 but I have to test it first on my Windows system. The MR is opened but still work in progress: #91

CyberGuerro commented 4 months ago

OK, tried your last ebuild:

  1. Crash plugin if device listted in config isn't found....... ....FIXED (tried with switch config, but without connect device and now plugin show error in ERROR DIALOG and XPLANE doesn't crash anymore)
  2. Radio device error still persist with this error (same config of the my bug opened message): XPanel [59844] [ERROR]:error in UsbHidDevice::send_feature_report reason=hid_error is not implemented yet

Attached Log.txt

I found this googling error, I don't know if it can help you to solve...

norberttak commented 4 months ago

I created a new build: https://github.com/norberttak/XPanel/actions/runs/8332736662/artifacts/1336532931 It contains the following updates:

Please test this build with the enclosed libraries.

To be sure I got all the details about your setup:

  1. You have Saitek Switch and Saitek Radio devices. Switch Panel works fine, and the error only raised with the Radio panel, right?
  2. Do you have any other plugin or application that connects to the Radio Panel? Maybe in the scripts of FlyWithLua?
  3. Please run the lsusb -t command to check what driver is loaded for the Saitek Radio panel
CyberGuerro commented 4 months ago

Tested: same error attach Log.txt To your questions:

  1. RIGHT
  2. No other plugins or Lua scripts
  3. this is the command output: lsusb
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 001 Device 002: ID 1462:7d25 Micro Star International MYSTIC LIGHT 
    Bus 001 Device 003: ID 05e3:0608 Genesys Logic, Inc. Hub
    Bus 001 Device 004: ID 05e3:0608 Genesys Logic, Inc. Hub
    Bus 001 Device 005: ID 1a40:0101 Terminus Technology Inc. Hub
    Bus 001 Device 006: ID 043e:9a10 LG Electronics USA, Inc. ASM107x
    Bus 001 Device 007: ID 058f:6364 Alcor Micro Corp. AU6477 Card Reader Controller
    Bus 001 Device 008: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
    Bus 001 Device 009: ID 03f0:e807 HP, Inc HP Webcam HD 4310
    Bus 001 Device 010: ID 131d:0159 Natural Point 
    Bus 001 Device 011: ID 046d:c52b Logitech, Inc. Unifying Receiver
    Bus 001 Device 012: ID 05e3:0610 Genesys Logic, Inc. Hub
    Bus 001 Device 013: ID 06a3:0d05 Saitek PLC Pro Flight Radio Panel
    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 002 Device 002: ID 05e3:0616 Genesys Logic, Inc. hub

    lsusb -t

    /:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/16p, 480M
    |__ Port 002: Dev 002, If 0, Class=Human Interface Device, Driver=usbhid, 12M
    |__ Port 005: Dev 003, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 002: Dev 005, If 0, Class=Hub, Driver=hub/4p, 12M
            |__ Port 001: Dev 009, If 0, Class=Video, Driver=uvcvideo, 12M
            |__ Port 001: Dev 009, If 1, Class=Video, Driver=uvcvideo, 12M
            |__ Port 001: Dev 009, If 2, Class=Audio, Driver=snd-usb-audio, 12M
            |__ Port 001: Dev 009, If 3, Class=Audio, Driver=snd-usb-audio, 12M
            |__ Port 001: Dev 009, If 4, Class=Human Interface Device, Driver=usbhid, 12M
            |__ Port 004: Dev 011, If 0, Class=Human Interface Device, Driver=usbhid, 12M
            |__ Port 004: Dev 011, If 1, Class=Human Interface Device, Driver=usbhid, 12M
            |__ Port 004: Dev 011, If 2, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 003: Dev 006, If 0, Class=Hub, Driver=hub/4p, 480M
            |__ Port 003: Dev 010, If 0, Class=[unknown], Driver=[none], 12M
        |__ Port 004: Dev 008, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
    |__ Port 008: Dev 012, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 003: Dev 013, If 0, Class=Human Interface Device, Driver=[none], 1.5M
    |__ Port 013: Dev 004, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 001: Dev 007, If 0, Class=Mass Storage, Driver=usb-storage, 480M
        |__ Port 001: Dev 007, If 1, Class=Human Interface Device, Driver=usbhid, 480M
    /:  Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/9p, 20000M/x2
    |__ Port 007: Dev 002, If 0, Class=Hub, Driver=hub/4p, 5000M

Can I suggest you to look Sparker project XSaitekPanels to get some ideas, In particular hidapi folder : You could try to compile the hidapi library for all 3 OS instead of using compiled libraries (lin & win) or better copy his hidapi into your project Maybe he uses a different driver (I'm thinking hidraw instead of hidusb)? You could ask him how is his approach in linux enviironment

norberttak commented 4 months ago

I have some small progress.

  1. I can reproduce the issue on my Linux laptop. I created a small test project (attached in the hidtest.tar.gz ) You can build it on your system as well. Please note, this is a standalone application using code parts from my plugin. It shall be run without XPlane simulator.

If I change the hidapi backend to hidraw (see the makefile HIDPKG variable), I have some more detailed error messages:

XPanel [54131] [ERROR]:error in UsbHidDevice::send_feature_report reason=ioctl (SFEATURE): Invalid argument

with libusb backend the same error message (not implemented ... ) appears what you found. I still have to understand what this error message means. It's strange that on Windows this is working properly. I'll search for this.

  1. I also checked the XSaitekpanel's source as you suggested. It's difficult to follow the code, but as far as I see they are doing the same. I'll look into details.

  2. Just a quick question: When you remove every multi_display entity from your config, the button handling is working with the Radio Panel? I mean the rotary encoders. If yes, it means only the write operation (send_fetaure_report) is failing in my code.

CyberGuerro commented 4 months ago
  1. I built successfully the sources...
  2. I connected the device
  3. I run the compiled output (hidtest) this is the output:
    HID test application
    Press 'q' to exit the application
    The log is saved into test_log.txt
    Segmentation error

attached log file test_log.txt

About your 3rd point I'll try modified config this evening when I'll come back home from work :-) ....stay tuned :-)

norberttak commented 4 months ago

based on what you wrote:

In particular [hidapi folder](https://github.com/sparker256/xsaitekpanels/tree/master/src/hidapi) : You could try to compile the hidapi library for all 3 OS instead of using compiled libraries (lin & win) or better copy his hidapi into your project
Maybe he uses a different driver (I'm thinking hidraw instead of hidusb)?

I updated my test application, and it now runs properly. Thanks for the hint. Now I use the hid.c from the latest version of hidapi instead of linking to the system installed libraries. I created a new build of the plugin on my Ubuntu. Unfortunately, I can't test it, so may I ask you to do a quick test with this package?

CyberGuerro commented 4 months ago

Now plugin doesn't load due this error: dlerror:/home/claudio/X-Plane 12/Resources/plugins/XPanel/64/lin.xpl: undefined symbol: hid_exit

About your previouse question:

Just a quick question: When you remove every multi_display entity from your config, the button handling is working with the Radio Panel? I mean the rotary encoders. If yes, it means only the write operation (send_fetaure_report) is failing in my code.

Error persist again whitout any section about multidisplay and buttons like this:

[device:id="saitek_radio"]
vid="6a3"
pid="d05"
CyberGuerro commented 4 months ago

I found this bug on hidapi repository and I suspect that it could be the reason of this bug. In the discussion someone suggests to use hidraw instead hidusb for Linux platform due a timeout issue

norberttak commented 4 months ago

Yes, I know this bug and I modified my build to use hidraw accordingly. It solved the issue with my test application, but unfortunately, the plugin still doesn't work in your environment (undefined symbol: hid_exit): https://github.com/norberttak/XPanel/actions/runs/8385560897/artifacts/1348881346

I gonna build a PC with Linux & X-Plane to be able to test the plugin on Linux. I try to do my tests tonight and I'll update you on the progress. Hope I can fix this hidapi related issue soon.

norberttak commented 4 months ago

I spent two days with a stupid mistake :-( I added the hidapi as a source to my project. It's a strange behavior of CMAKE that it ignores silently the .c file if the project is c++. It doesn't matter I added the hid.c to the source tree explicitly. Anyhow, I built a new version of the plugin. Meanwhile, I have a Linux PC running Ubuntu 22.04 and XPlane12. The Zibo with your configuration works fine. So I'm pretty confident the issue solved. Could you please test it on your environment as well? XPanel_linux.zip

Just for reference, here is the dependencies you have to install:

ldd lin.xpl
        linux-vdso.so.1 (0x00007fff9fba0000)
        libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007fc75c6d1000)
        liblua5.4.so.0 => /lib/x86_64-linux-gnu/liblua5.4.so.0 (0x00007fc75c68f000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fc75c463000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fc75c37c000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fc75c35c000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc75c133000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fc75c81c000)

If it works fine I will merge it to the main line and will create a new release. ,Norbert

CyberGuerro commented 4 months ago

I'm sorry, but it doesn't work...... the difference now is the error:

XPanel [28748] [DEBUG]:add new saitek radio panel device
XPanel [28748] [DEBUG]:UsbHidDevice: call hid_init()
XPanel [28748] [DEBUG]:UsbHidDevice: successful hid_init
XPanel [28801] [DEBUG]:UsbHidDevice connect successful. vid=1699 pid=3333
XPanel [34254] [ERROR]:error in UsbHidDevice::send_feature_report reason=ioctl (SFEATURE): Connessione scaduta
XPanel [34254] [ERROR]:SaitekRadioPanel connect. error in write_device
XPanel [34254] [DEBUG]:SaitekRadioPanel::start called
XPanel [34254] [DEBUG]:UsbHidDevice::start

(error is in my language: italian) which means "Connection timed out" it seems that there is a timeout issue as mentioned in my previous message (hidapi bug) attached complete Log.txt

norberttak commented 4 months ago

The bug you mentioned shouldn't play in my latest version. That bug is about the libusb backend, and my plugin now contains the hid.c with hidraw backend. I modified my plugin to use hiddraw instead of libusb in PR: #94 The send_feature_report() in my plugin is different from in that bug

We could do a few things here:

  1. Please remove all libraries from the XPanel/64 folder. Only the lin.xpl shall be there.
  2. Please be sure the libusb is not installed on your system (at least for a test). It shouldn't be loaded by my plugin, but I'm not aware of the magic of loading the libraries by Linux. The libusb related libraries on my Ubuntu are: libhidapi-libusb0 and libusb-1.0-0
  3. I added an extra setting to the CMAKE. The XSaitek panel uses this. On Ubuntu I didn't need it but may be it could help on Gentoo Linux.
  4. Based on the previous: You may try to compile my code from this branch: 90-bug-plugin-crash-with-saitek-radio-panel Please check the runtime dependency by the ldd command

The latest Ubuntu 22.04 binary build from my branch is here

CyberGuerro commented 4 months ago

Your last binary (with libraries inside plugin's folder) give me this ldd output:

ldd lin.xpl
        linux-vdso.so.1 (0x00007ffd8c84e000)
        libudev.so.1 => /mnt/X-Plane_Data/0/Plugins/XPanel/64/./libudev.so.1 (0x00007f6ee659e000)
        liblua5.4.so.0 => /mnt/X-Plane_Data/0/Plugins/XPanel/64/./liblua5.4.so.0 (0x00007f6ee655c000)
        libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++.so.6 (0x00007f6ee6200000)
        libm.so.6 => /usr/lib64/libm.so.6 (0x00007f6ee6124000)
        libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/13/libgcc_s.so.1 (0x00007f6ee64fe000)
        libc.so.6 => /usr/lib64/libc.so.6 (0x00007f6ee5f46000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f6ee66e2000)

removing all libraries I have this output

ldd lin.xpl
./lin.xpl: /usr/lib64/liblua5.4.so.0: no version information available (required by ./lin.xpl)
        linux-vdso.so.1 (0x00007ffc889a8000)
        libudev.so.1 => /usr/lib64/libudev.so.1 (0x00007f1cf22e7000)
        liblua5.4.so.0 => /usr/lib64/liblua5.4.so.0 (0x00007f1cf22a5000)
        libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++.so.6 (0x00007f1cf2000000)
        libm.so.6 => /usr/lib64/libm.so.6 (0x00007f1cf1f24000)
        libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/13/libgcc_s.so.1 (0x00007f1cf2280000)
        libc.so.6 => /usr/lib64/libc.so.6 (0x00007f1cf1d46000)
        libcap.so.2 => /usr/lib64/libcap.so.2 (0x00007f1cf2271000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f1cf247c000)

I tried to build your sources as indicated in your point 4, but it doesn't build due an error in your sources:

[ 70%] Building CXX object src/CMakeFiles/xpanel.dir/devices/fip/FIPDevice.cpp.o
[ 74%] Building CXX object src/CMakeFiles/xpanel.dir/devices/fip/FIPPage.cpp.o
In file included from /home/claudio/Desktop/XPanel-90-bug-plugin-crash-with-saitek-radio-panel/src/devices/fip/FIPPage.h:10,
                 from /home/claudio/Desktop/XPanel-90-bug-plugin-crash-with-saitek-radio-panel/src/devices/fip/FIPPage.cpp:6:
/home/claudio/Desktop/XPanel-90-bug-plugin-crash-with-saitek-radio-panel/src/devices/fip/FIPLayer.h:12:9: error: ‘uint8_t’ does not name a type
   12 |         uint8_t r;
      |         ^~~~~~~
/home/claudio/Desktop/XPanel-90-bug-plugin-crash-with-saitek-radio-panel/src/devices/fip/FIPLayer.h:10:1: note: ‘uint8_t’ is defined in header ‘<cstdint>’; did you forget to ‘#include <cstdint>’?
    9 | #include <fstream>
  +++ |+#include <cstdint>
   10 | 

You have to add #include <cstdint> in your /src/devices/fip/FIPLayer.h after row #include <fstream>

After changes I built it, I used it, but same error. this is the output of ldd:

ldd lin.xpl
        linux-vdso.so.1 (0x00007fffb66c7000)
        libudev.so.1 => /usr/lib64/libudev.so.1 (0x00007f40973f1000)
        liblua5.4.so.0 => /usr/lib64/liblua5.4.so.0 (0x00007f40973af000)
        libstdc++.so.6 => /usr/lib/gcc/x86_64-pc-linux-gnu/13/libstdc++.so.6 (0x00007f4097000000)
        libm.so.6 => /usr/lib64/libm.so.6 (0x00007f40972d3000)
        libgcc_s.so.1 => /usr/lib/gcc/x86_64-pc-linux-gnu/13/libgcc_s.so.1 (0x00007f40972ae000)
        libc.so.6 => /usr/lib64/libc.so.6 (0x00007f4096e22000)
        libcap.so.2 => /usr/lib64/libcap.so.2 (0x00007f409729f000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f4097581000)

One question: How is the node in /dev of your Linux box when you attach saitek device? I'm asking to myself if could be a permission's issue..... but it's strange because other plugins works with saitek devices.....

norberttak commented 4 months ago

The only thing that is strange in your ldd is the libcap. I'm not a Linux guru so maybe it's not important but that lib is about the user access rights. which may cause some permission issue??? Anyhow I don't know why it is linked to the plugin when you build it.

My device tree looks like this with the 3 Saitek devices I have:

norbi@norbi-linux:~$ ls -la /dev/saitek*
lrwxrwxrwx 1 root root 7 márc  24 20:57 /dev/saitekmultipanel -> hidraw4
lrwxrwxrwx 1 root root 7 márc  24 20:57 /dev/saitekradiopanel -> hidraw1
lrwxrwxrwx 1 root root 7 márc  24 20:57 /dev/saitekswitchpanel -> hidraw9

This the content of my rule file (/etc/udev/rules.d/99-saitek.rules)

KERNEL=="hidraw*", ATTRS{idProduct}=="0d67", ATTRS{idVendor}=="06a3", MODE="0666", SYMLINK+="saitekswitchpanel"
KERNEL=="hidraw*", ATTRS{idProduct}=="0d05", ATTRS{idVendor}=="06a3", MODE="0666", SYMLINK+="saitekradiopanel"
KERNEL=="hidraw*", ATTRS{idProduct}=="0d06", ATTRS{idVendor}=="06a3", MODE="0666", SYMLINK+="saitekmultipanel"
BUS=="usb", ATTRS{idProduct}=="0d05", ATTRS{idVendor}=="06a3", MODE="0666"
BUS=="usb", ATTRS{idProduct}=="0d06", ATTRS{idVendor}=="06a3", MODE="0666"
BUS=="usb", ATTRS{idProduct}=="0d67", ATTRS{idVendor}=="06a3", MODE="0666"

When you say other plugins, you mean XSaitekpanel? If yes I need to double(triple) check the cmake files in that repo. Unfortunately, not all cmake files are in use so it's pretty hard to follow what is live and what is dead code there.

norberttak commented 4 months ago

The update for missing #include <fstream> has been merged and this branch has been rebased #96

CyberGuerro commented 4 months ago

When you say other plugins, you mean XSaitekpanel? If yes I need to double(triple) check the cmake files in that repo. Unfortunately, not all cmake files are in use so it's pretty hard to follow what is live and what is dead code there.

Yes, I noticed this: If first I run X-Plane with your plugin (with error) and then restart X-Plane switching to XSaitekPanel I have to disconnect device and reconnect because XSaitekPanel doesn't recognize it.

If I use ever xsaitepanel every X-Plane start is ok. Can I suggest you to ask support to Sparker (the author of xSaitekPanels), Hes a Linux developer and very very helpful :-)

These are my udev rules:

KERNEL=="hidraw*", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0d67", MODE="0666", SYMLINK+="saitekswitchpanel"
KERNEL=="hidraw*", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0d05", MODE="0666", SYMLINK+="saitekradiopanel%n"
KERNEL=="hidraw*", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0d06", MODE="0666", SYMLINK+="saitekmultipanel"
KERNEL=="hidraw*", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0b4e", MODE="0666", SYMLINK+="saitekbippanel"
KERNEL=="hidraw*", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0b4d", MODE="0666", SYMLINK+="saitektpmpanel"
SUBSYSTEM=="usb", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0d05", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0d06", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0d67", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0b4e", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="06a3", ATTRS{idProduct}=="0b4d", MODE="0666"

For saitek radio panels I have to enumerate my devices with "%n" suffix

norberttak commented 4 months ago

For saitek radio panels I have to enumerate my devices with "%n" suffix Does it mean you have more than one Radio devices connected?

CyberGuerro commented 4 months ago

For saitek radio panels I have to enumerate my devices with "%n" suffix Does it mean you have more than one Radio devices connected?

In this Test phase only 1, but usually I connect 3 Radio panels. I think that when I connect Radio panel device (independent by number of devices), rule create symlink with suffix (but this doesn't give any problem with XSaitekPanels plugin).

What I don't understand is error message "connection timed out"... ...it seems that plugin is able to connect to device, but when it try to write bytes to it, connection is closed/fallen...

During my last test, I tried to remove all plugins, but nothing had changed

norberttak commented 3 months ago

there are two differences between my plugin and xsaitek plugin:

  1. they use hid_enumerate and hid_open_path while my plugin simple call hid_open
  2. xsaitek plugin simple ignores the return value of hid_send_feature_report while my plugin stops itself upon an error from that hid function.

I create a test version with the above two updates. If an error happens in hid_send_feature_report you will see the error message but the plugin tries to continue. lin.zip

It works on my Ubuntu box.

CyberGuerro commented 3 months ago

I'm afraid, it doesn't work, same error. Before start xplane I removed all files in XPanel/64 and copied content of your zip (only lin.xpl). Is it right?

Attach Log.txt

norberttak commented 3 months ago

Could you please check the flywithlua plugin and its scripts? I see these lines in your last log file:

FlyWithLua Info: HID access initialized.
FlyWithLua Info: FlyWithLua.ini full path 
/home/claudio/X-Plane 12/Resources/plugins/FlyWithLua/Internals/FlyWithLua.ini
FlyWithLua Info: Discovered 8 HID devices.
FlyWithLua Info: Initial assignments successfully saved.

...
FlyWithLua Info: Start loading script file /home/claudio/X-Plane 12/Resources/plugins/FlyWithLua/Scripts/xsaitekpanels-scripts-zibo.lua
FlyWithLua Info: Finished loading script file /home/claudio/X-Plane 12/Resources/plugins/FlyWithLua/Scripts/xsaitekpanels-scripts-zibo.lua
CyberGuerro commented 3 months ago

Removed all plugins, but nothing change.... attach Log.txt

And now when I close X-Plane it crash....

norberttak commented 3 months ago

It's not the same actually.

In your previous test, there are other error messages from my plugin:

XPanel [4027] [ERROR]:error in UsbHidDevice::hid_read reason=hid_read_timeout: unexpected poll error (device disconnected)
XPanel [4027] [ERROR]:UsbHidDevice thread_func: error reading HID device. vid=1699 pid=3333
XPanel [4027] [DEBUG]:UsbHidDevice thread_func: exit vid=1699 pid=3333
XPanel [18141] [INFO]:Reload plugin initiated
XPanel [18141] [DEBUG]:SaitekRadioPanel::stop called
XPanel [18141] [ERROR]:error in UsbHidDevice::send_feature_report reason=ioctl (SFEATURE): Nessun device corrisponde
XPanel [18141] [ERROR]:SaitekRadioPanel stop. error in write_device

I think that was due to the other plugin (flywithlua scripts) that tried to access the USB hid device.

In the lastest log I see only these error messages:

XPanel [6841] [ERROR]:error in UsbHidDevice::send_feature_report reason=ioctl (SFEATURE): Connessione scaduta

Which could be normal :-) As I wrote the plugin still log this error messages but don't stop working. It would be the same as xsaitek panel handle the error in hid_send_feature_report() Are you sure the radio panel doesn't work? Please note the displays remain dark until you don't change the rotary switches on the left side.

CyberGuerro commented 3 months ago

No, it doesn't work, I tried as you say, but nothing works: display, rotator, button..... I tried with default cessna, removed all plugins (flywithlua too), but nothing, only and ever same error.

To exclude all impossible things, could you share a xpanel.ini to test radio with cessna 172 Default?

norberttak commented 3 months ago

Default Cessna 172: I tested the radio panel with the same configuration what you used for the Zibo. It works fine for me. I attached my xpanel.ini (in zip file) and the Log.txt (I removed none XPanel related lines) Log.txt xpanel.zip

CyberGuerro commented 3 months ago

Your xpanel.ini doesn't work due this warning: XPanel [39736] [WARNING]:Config was created for another aircraft (C172.acf). Current is Cessna_172SP.acf Infact I had to change it in the correct acf's name. Then error persist and panel doesn't work....

XPanel [39736] [DEBUG]:add new saitek radio panel device
XPanel [39736] [DEBUG]:UsbHidDevice: call hid_init()
XPanel [39736] [DEBUG]:UsbHidDevice: successful hid_init
XPanel [39737] [DEBUG]:UsbHidDevice connect successful. vid=1699 pid=3333
XPanel [44806] [ERROR]:error in UsbHidDevice::send_feature_report reason=ioctl (SFEATURE): Connessione scaduta
XPanel [44806] [ERROR]:SaitekRadioPanel connect. error in write_device
XPanel [44806] [DEBUG]:SaitekRadioPanel::start called
XPanel [44806] [DEBUG]:UsbHidDevice::start

What I don't understand is : because it persist to go in error. I don't care if the error is managed, the point is... ...the plugin haven't to go in error. I think that this is the first problem to solve....

Finally I think that errors are 2:

  1. send_feature_report function that return timed out connection (You say that is managed and plugin still working)
  2. error in write_device (I think this is the real error, which stop plugin)
norberttak commented 3 months ago
  1. the warning about acf file doesn't matter. I was just lazy to modify it :-) It doesn't disturb the plugin's work.
  2. I agree that the main point is to understand why do you have the error in hid_send_feature_report() function. Please note the error from write_device is the same as send_feature_report error. here is the code that prints this error. So there are no two different errors.
  3. The same binary is working on my Ubuntu so the problem could be either (or both): a. your Gentoo Linux has different settings (permission or whatever) that prevents the plugin to send feature report to the device b. because the xsaitekpanel works on your system, it indicates that my plugin do the initialization on a different way that cause the problem on you system. The only difference between xsaitekpanel and my plugin is that they don't check and don't print error messages upon hid_send_feature_report() function. My plugin stopped working on the first error. I supposed that this error is only during the initialization phase and xsaitekpanel also suffers about the same error but it simple ignores it.

While I'm writing these lines, I found another point where I check the status of the hid_send_feature_report() function. I removed the error handling (keeps the error print only). On that way it will do the same as xsaitekpanel. If this version works we can narrow down the problem to system settings on your linux. lin.zip

Please do a quick test (remove all other plugins) and send me the log.txt

It would also good to see the dmesg output during plugin loading:

sudo dmesg | grep ".*hid.*\|.*usb.*\|.*error.*"
CyberGuerro commented 3 months ago

Id doesn't work again same error. attached:

XPanel [32954] [DEBUG]:UsbHidDevice: call hid_init()
XPanel [32954] [DEBUG]:UsbHidDevice: successful hid_init
XPanel [32955] [DEBUG]:UsbHidDevice connect successful. vid=1699 pid=3333
XPanel [37983] [ERROR]:error in UsbHidDevice::send_feature_report reason=ioctl (SFEATURE): Connessione scaduta
XPanel [37983] [DEBUG]:SaitekRadioPanel connect. successful
XPanel [37983] [DEBUG]:SaitekRadioPanel::start called
XPanel [37983] [DEBUG]:UsbHidDevice::start
XPanel [37984] [INFO]:successful init and start plugin

I noticed this thing when using xSaitekPanels: when X-Plane start (before starting flight), the plugin is loaded and display of radio devices show this:

[device number - 1]   [version of plugin]
[device number - 2]   [version of plugin]

in real environment like this (3 devices)

[1 - 1             ]    [             3.09]
[1 - 2             ]    [             3.09]

[2 - 1             ]    [             3.09]
[2 - 2             ]    [             3.09]

[3 - 1             ]    [             3.09]
[4 - 2             ]    [             3.09]

This could be useful to test plugin without start a flight and aircraft configuration wouldn't be necessary for device connectivity test :-)

norberttak commented 3 months ago

my plugin initialize only those devices that are in the actual xpanel.ini config file (placed in the aircraft folder). I don't load the devices when the XPlane simulator starts, only at that point where you start to load the airplane.

If it is more convenient, I can create a small standalone application to test the HID devices.

norberttak commented 3 months ago

Here is a test application contains the same code parts that the plugin use: hidtest.tar.gz The package contains the compiled binary (hidtest) and the source code as well. You can compile it if you wish:

make clean
make
./hidtest

If it works you will see a lot of XPanel [40538] [TRACE]:successful hid_send_feature_report log lines on the console and the radio panel display will display 0..9 numbers periodically changing. The application logs are also saved into test_log.txt

This is the output on my console when I run this test program:

norbi@norbi-linux:~/src/hidtest$ ./hidtest
HID test application
The log is saved into test_log.txt
XPanel [3153] [DEBUG]:UsbHidDevice: call hid_init()
XPanel [3153] [DEBUG]:UsbHidDevice: successful hid_init
XPanel [3155] [DEBUG]:device opened: vid=1699 pid=3333
XPanel [3155] [DEBUG]:UsbHidDevice::start
XPanel [3155] [TRACE]:UsbHidDevice::thread_func: started for vid=1699 pid=3333
XPanel [3178] [TRACE]:successful hid_send_feature_report
XPanel [3178] [TRACE]:successful device_read
...
XPanel [8080] [TRACE]:successful hid_send_feature_report
XPanel [8080] [TRACE]:successful device_read
XPanel [8080] [DEBUG]:UsbHidDevice thread_func: exit vid=1699 pid=3333
XPanel [8081] [DEBUG]:UsbHidDevice::stop. thread finish ? 1 remaining time=482
XPanel [8081] [DEBUG]:UsbHidDevice::release called for vid=1699 pid=3333
XPanel [8081] [DEBUG]:UsbHidDevice release
XPanel [8081] [DEBUG]:All USB HID devices are closed. call hid_exit()
Application stopped
XPanel [8081] [TRACE]:UsbHidDevice::~UsbHidDevice() vid=1699 pid=3333

One more thing you can test: The hidapitester could be a good tool to see what's on your system

./hidapitester --vidpid 06a3:0d05 --verbose --open --list-detail see some details about your radio device

./hidapitester --vidpid 06a3:0d05 --open --get-report-descriptor print out the report descriptor of your device

./hidapitester --vidpid 06a3:0d05 --open --send-feature 3 it will set the first digit of top-left display on the radio dvice to 3

CyberGuerro commented 3 months ago

TEST APP WORKS!!!! :+1: :+1: :+1: Displays show numers :-) attach test_log.txt

Tried hidapitester and it works has expected 👍

norberttak commented 3 months ago

It's good news 👍 Now, the strange thing is that this test application uses the same code as XPanel uses :-) Just to be 100% sure the xpanel plugin doesn't work, I recompiled the whole project again. Could you please test this version? Sorry for the many iterations, but this issue is really tricky. Please be sure all other plugins are removed for the test.

If this still doesn't work, then maybe something in your XPlane simulator interferes with my plugin. Do you start any other HID related applications alongside the simulator?

FYI: Here it is the code updates around hid initialization: https://github.com/norberttak/XPanel/pull/97 The enclosed lin.xpl contains these modifications.

CyberGuerro commented 3 months ago

Your plugin doesn't want to work...... Removed all plugins and now when I close X-Plane it crash.... attached Log.txt

What I'm asking to myself is: which is the differences between you plugin and xsaitekpanels in terms of:

When you find them you probably find the answer to this mystery....

Unfortunately I'm not C++ developer and I don't understand the code :-( :-( :-( Can I suggest to ask help to Sparker?

norberttak commented 3 months ago

I'm getting run out the ideas what could be the issue here :-( Regarding your points in the previous message:

  1. Now I moved the HID initialization to the point where XPlane starts (that's what you asked for display something on the radio panel before airplane loaded). With this I moved the hid initialization to the very beginning of my plugin. XSaitekpanel do the similar.

  2. Otherwise, the initialization steps are identical in the two plugins (hid_enumerate, hid_open_path, hid_set_nonblocking, hid_free_enumeration)

With this version you should see 123 on the top-left display of radio panel before any aircraft loaded. If it works please try to load an aircraft.

CyberGuerro commented 3 months ago

Now when I start X-Plane display show this:

[12300   ]   [00-      ]
[ 0000   ]   [0754     ]

Then, when I load Cessna Error windows show known error and the device doesn't work.

Then I close X-Plane without any crash :-) I found this in the log, before X-plane load aircraft: XPanel [54533] [INFO]:XPLM_MSG_PLANE_CRASHED or XPLM_MSG_PLANE_UNLOADED message received

attached Log.txt

norberttak commented 3 months ago

and what if you reload the plugin (menu --> Plugins --> XPanel--> reload plugin)

CyberGuerro commented 3 months ago

and what if you reload the plugin (menu --> Plugins --> XPanel--> reload plugin) Tried before write my last message... I think you should find "reload" call in the Log.txt attached before.

norberttak commented 3 months ago

Sorry, I didn't recognized the reload message in your log files (I had a quick view on my phone only)

I added a hack to my code: it opens the radio devices at the very beginning but it don't close when airplane loaded (the version from yesterday closed and reopened the radio device upon plane loaded) lin.zip All you radios shall display 12345 on the top-left display. I hope after an airplane loaded it still works.

CyberGuerro commented 3 months ago

Well.... as you said when X-Plane 12 starts all my 3 radio's display show "12345", but when I load aircraft, plugin stop working and shows errors in windows dialog. attached Log.txt

Can I ask you (if is it possible) to remove/comment all "send_feature_report" call from all your code (it seems that it doesn't work) so we remove annoying message error?

norberttak commented 3 months ago

I removed the send_feature_report calls from this version lin-no-feature-report.zip Please note the send_feature_report is used to set the display on the radio device so this version wont show you the radio frequencies only the buttons will work.

I also created another version lin-early-load.zip This version is initializing the plugin in much earlier than the original. Could you please test this as well? Please run this command after the aircraft is loaded: lsof /dev/saitekradiopanel1 It will show which processes are attached to the device. On my Ubuntu it shows this while XPlane is running:

norbi@norbi-linux:~/src/XPanel$ lsof /dev/saitekradiopanel1
COMMAND    PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
Main\x20T 4937 norbi  164u   CHR  241,1      0t0  462 /dev/hidraw1
Main\x20T 4937 norbi  265u   CHR  241,1      0t0  462 /dev/hidraw1
CyberGuerro commented 3 months ago

plugin with no-feature-report works (buttons and rotaries); I only noticed that when i push lower switch button, X-Plane zooms the view and keyboard doesn't work until I disconnect device.

plugin with early-load doesn't work as usually. this is the output of command:

lsof /dev/saitekradiopanel7 
COMMAND    PID    USER  FD   TYPE DEVICE SIZE/OFF NODE NAME
Main\x20T 7431 claudio 157u   CHR  236,7      0t0 1382 /dev/hidraw7
Main\x20T 7431 claudio 336u   CHR  236,7      0t0 1382 /dev/hidraw7

PS. I think that in your country is late and so I'd like to wish you Happy Easter, I don't want you brake your head during the holydays, so I understand if we restart THE FIXING on tuesday...... ...but if you want I'm here to help you as I can :-)

norberttak commented 3 months ago

It's very strange. I noticed the same behavior (zoom on lower switch button). But only with the no-feature-report version. xsaitekpanel has a description about how to solve this kind of mouse interference: https://github.com/sparker256/xsaitekpanels/blob/master/docs/Linux_Users_Please_Read.txt That solved my problem.

The identifier in the above description is not up-to-date. You can see the correct names in the output of lsusb command.

I'm in Hungary so, I think we are in the same time zone. I really want to solve this issue, so I'll think more about it during the Easter holiday. Happy Easter to you as well!

CyberGuerro commented 3 months ago

About the behavior I solved: I have to deactivate device in KDE, infact it identify Radio Devices as mouse device. After deactivated no more interference between keyboard/mouse and saitek :-)

norberttak commented 3 months ago

I created another version:

CyberGuerro commented 3 months ago

Now: if I connect 1 device (radio), x-plane loads aircraft, but panel is "cold and dark" and no buttons, no display, no knobs, no error window..... attached Log.txt If I attach all my 3 radio devices, X-Plane freezes during initial load ("Initialize plugins" phase) For future I'll test with only one device connected (radio) and then, when it will be ok, I'll test with all 3 devices connected :-)