s-victor / TinyPedal

Free and Open Source telemetry overlay application for racing simulation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TinyPedal working on Linux

berarma opened this issue · comments

Hi.

I have TinyPedal running on Linux pretty well after some changes to the code. There are some issues that could be changed with some more changes.

I want to create PR and I'm willing to support the tool on Linux. I can't help much with the Windows support because I don't have a Windows installation to test but I'm doing the changes to be as safe as possible for other platforms.

How do you feel about going cross-platform with TinyPedal?

To iron out the remaining issues I would need to do further changes to the code that would be easier if it got some refactorization to avoid duplication of code. Would you mind that I create PR for those refactorization changes too?

Thanks for this tool.

commented

Hello,

That is a very good news that you managed to make the app work on linux, and please feel free to open PR or do the changes as required.

And having cross-platform is good too. I can definitely help and testing code for windows platform. However since I don't use linux, providing support with linux related code will not be possible for me, so this will require your expertise (or others) if possible.

Thanks and let me know your opinion.

Of course, I want to help. I'll shortly make a first PR for the essential changes. We can discuss further changes later.

Thanks!

commented

Awesome, thanks!

commented

I have just managed to run the APP natively (not through wine) under fedora37 (LXDE spin), and noticed following things:

  1. Tray icon menu doesn't work. After check pystray docs, know that pystray doesn't support menu under Xorg.
  2. Left clicking interaction (default=True) also not working with LXDE's system tray, while pystray docs here says it supports it under Xorg. I can only guess that maybe other "Desktop Environment" would work with this function, but not every DE.

Since both icon & menu interaction is not possible, I can't trigger the decoration issue you have mentioned.

My idea and solution is probably to create some kind of widget control panel window, then put all tray menu stuff into the panel window, where user can control widgets there. One of the advantages of having a panel window is that toggling widget would be much faster and easier.

The disadvantage is that this central control panel has to be visible all the time, and can't be locked(has to be always clickable by user), so this may not be an optimal solution. One way is to make the panel expandable and only interact with middle or right mouse click so that user won't accidentally activate something unwanted. This will need further investigation.

Nevertheless, there need to be a better way to exit APP on linux, as tray icon interaction is not possible on every distro (such as LXDE).

I have just managed to run the APP natively (not through wine) under fedora37 (LXDE spin), and noticed following things:

1. Tray icon menu doesn't work. After check pystray docs, know that pystray doesn't support menu under Xorg.

2. Left clicking interaction (default=True) also not working with LXDE's system tray, while [pystray docs here](https://pystray.readthedocs.io/en/latest/usage.html#getting-input-from-the-system-tray-icon) says it supports it under Xorg. I can only guess that maybe other "Desktop Environment" would work with this function, but not every DE.

Since both icon & menu interaction is not possible, I can't trigger the decoration issue you have mentioned.

My idea and solution is probably to create some kind of widget control panel window, then put all tray menu stuff into the panel window, where user can control widgets there. One of the advantages of having a panel window is that toggling widget would be much faster and easier.

The disadvantage is that this central control panel has to be visible all the time, and can't be locked(has to be always clickable by user), so this may not be an optimal solution. One way is to make the panel expandable and only interact with middle or right mouse click so that user won't accidentally activate something unwanted. This will need further investigation.

Nevertheless, there need to be a better way to exit APP on linux, as tray icon interaction is not possible on every distro (such as LXDE).

I have it working on Gnome with appindicator extension and others have used it with KDE. Your proposal would be the only solution for all desktop environments.

commented

Thanks for confirmation, I feel the same. I'll try create a widget control panel in the coming days and see how it works.

Hello,

I have not tested it yet on openSUSE but have a question already:
When you run it nativelly, does it display the data properly?

I'm asking because IIRC the shared memory is 'locked' within the proton-vessel, so I wonder how tinypedal is able to 'read it'.

thanks!

Hello,

I have not tested it yet on openSUSE but have a question already: When you run it nativelly, does it display the data properly?

I'm asking because IIRC the shared memoty is 'locked' within the proton-vessel, so I wonder how tinypedal is able to 'read it'.

thanks!

I didn't get to mention it but you need this rFactor 2 plugin: https://github.com/schlegp/rF2SharedMemoryMapPlugin_Wine

There's a compiled dll in the build directory.

It's a fork of the original plugin. The original plugin has to be disabled.

Yeah that was the missing piece, working fine for me as well.

commented

hi guys,

I have just pushed a new update with new widget control menu (through preset manager), and all functions (including lock overlay) are working correctly under linux now.

You can find more info here:
https://forum.studio-397.com/index.php?threads/tinypedal-open-source-overlay-app-for-rf2-radar-pedal-ffb-deltabest-relative-fuel-calculator.71557/page-14#post-1119409

Lemme know for any issue & feedback.

Cheers

I'll test it as soon as I can and add the missing pieces. It's awesome the amount of work you put on all your projects. Thanks!

Awesome!! Thank you both very much!!

It's working very well, just one little issue that can be easily fixed. For some reason, setting the widget alpha (opacity) doesn't work unless it's executed after the call to self.lift(), at the very end of the Base.init method.

commented

Awesome, it's done, thanks!

@s-victor and @berarma , thanks a lot for bring to Linux this HUD. You make a great work and I'm very pleased to use it with rFactor 2. Yesterday I recorded a video with it, I hope you like it:
https://youtu.be/-sAz7f14rC8

Of course, I will follow this project and his updates. Cheers!

I have a couple projects which may be of interest. Particularly my shared memory tool. It uses another project called simapi, so that the goal is it can support unlimited sim titles. Right now, the code that's there for the simshmbridge is only for AC, but I've had RF2 working before, so i can add it as soon as possible.

Just info for the unaware, recent commit may cause startup failure in Linux, at least on my distro, here fixed by installing pyxdg:
pip install pyxdg

Just info for the unaware, recent commit may cause startup failure in Linux, at least on my distro, here fixed by installing pyxdg:
pip install pyxdg

Yes. I have to write the instructions for Linux. I'll do it for next release hopefully.

commented

Hi, a quick notice, all player synced method including the linux related code from API submodule are separated into the file sim_info_sync.py s-victor/pyRfactor2SharedMemory@47a0c6e , both rF2data.py & sharedMemoryAPI.py were reverted back to be the same as upstream version.

This should help keep things unaffected from any future changes of the API (as RF2's recent update seems adding more API data). Remember to update submodule with new TinyPedal changes. Let me know if any issue.

Hi,

I have follow the instruction on the readme, by i have an issue when i try to run run.py, i take the master branch of
pyRfactor2SharedMemory

[zapoutix@bakalinux TinyPedal-1.11.7]$ python run.py 
Traceback (most recent call last):
  File "/home/zapoutix/Downloads/TinyPedal-1.11.7/run.py", line 61, in <module>
    load_tinypedal()
  File "/home/zapoutix/Downloads/TinyPedal-1.11.7/run.py", line 53, in load_tinypedal
    from tinypedal.preset import LoadPreset
  File "/home/zapoutix/Downloads/TinyPedal-1.11.7/tinypedal/preset.py", line 32, in <module>
    from .readapi import info
  File "/home/zapoutix/Downloads/TinyPedal-1.11.7/tinypedal/readapi.py", line 42, in <module>
    info = SimInfoSync()
  File "/home/zapoutix/Downloads/TinyPedal-1.11.7/pyRfactor2SharedMemory/sim_info_sync.py", line 47, in __init__
    self.start_mmap()
  File "/home/zapoutix/Downloads/TinyPedal-1.11.7/pyRfactor2SharedMemory/sim_info_sync.py", line 64, in start_mmap
    self._rf2_tele = mmap.mmap(tele_file.fileno(), ctypes.sizeof(rF2data.rF2Telemetry))
ValueError: mmap length is greater than file size
setting saved
Exception ignored in: <function SimInfoSync.__del__ at 0x7fe02a58c820>
Traceback (most recent call last):
  File "/home/zapoutix/Downloads/TinyPedal-1.11.7/pyRfactor2SharedMemory/sim_info_sync.py", line 184, in __del__
    self.close()
  File "/home/zapoutix/Downloads/TinyPedal-1.11.7/pyRfactor2SharedMemory/sim_info_sync.py", line 89, in close
    self._rf2_tele.close()
AttributeError: 'NoneType' object has no attribute 'close'

I am using ArchLinux, with the lastest version of Rfactor2 (v1132)

i got all the $rFactor2SMMP_* then i do a ls /dev/shm

-rw-r--r--  1 zapoutix zapoutix    10152  1 avril 11:09 '$rFactor2SMMP_Extended$'
-rw-r--r--  1 zapoutix zapoutix       16  1 avril 11:09 '$rFactor2SMMP_ForceFeedback$'
-rw-r--r--  1 zapoutix zapoutix      272  1 avril 11:09 '$rFactor2SMMP_Graphics$'
-rw-r--r--  1 zapoutix zapoutix      116  1 avril 11:09 '$rFactor2SMMP_HWControl$'
-rw-r--r--  1 zapoutix zapoutix    39792  1 avril 11:09 '$rFactor2SMMP_MultiRules$'
-rw-r--r--  1 zapoutix zapoutix      340  1 avril 11:09 '$rFactor2SMMP_PitInfo$'
-rw-r--r--  1 zapoutix zapoutix       20  1 avril 11:09 '$rFactor2SMMP_PluginControl$'
-rw-r--r--  1 zapoutix zapoutix    45272  1 avril 11:09 '$rFactor2SMMP_Rules$'
-rw-r--r--  1 zapoutix zapoutix    45272  1 avril 11:09 '$rFactor2SMMP_RulesControl$'
-rw-r--r--  1 zapoutix zapoutix    75312  1 avril 11:09 '$rFactor2SMMP_Scoring$'
-rw-r--r--  1 zapoutix zapoutix   241680  1 avril 11:09 '$rFactor2SMMP_Telemetry$'
-rw-r--r--  1 zapoutix zapoutix      632  1 avril 11:09 '$rFactor2SMMP_Weather$'
-rw-r--r--  1 zapoutix zapoutix      628  1 avril 11:09 '$rFactor2SMMP_WeatherControl$'

Do you know how i can fix this issue .

Regards
Mathieu

commented

Hi,

I have follow the instruction on the readme, by i have an issue when i try to run run.py, i take the master branch of
pyRfactor2SharedMemory

[zapoutix@bakalinux TinyPedal-1.11.7]$ python run.py 
Traceback (most recent call last):
  File "/home/zapoutix/Downloads/TinyPedal-1.11.7/run.py", line 61, in <module>
    load_tinypedal()
  File "/home/zapoutix/Downloads/TinyPedal-1.11.7/run.py", line 53, in load_tinypedal
    from tinypedal.preset import LoadPreset
  File "/home/zapoutix/Downloads/TinyPedal-1.11.7/tinypedal/preset.py", line 32, in <module>
    from .readapi import info
  File "/home/zapoutix/Downloads/TinyPedal-1.11.7/tinypedal/readapi.py", line 42, in <module>
    info = SimInfoSync()
  File "/home/zapoutix/Downloads/TinyPedal-1.11.7/pyRfactor2SharedMemory/sim_info_sync.py", line 47, in __init__
    self.start_mmap()
  File "/home/zapoutix/Downloads/TinyPedal-1.11.7/pyRfactor2SharedMemory/sim_info_sync.py", line 64, in start_mmap
    self._rf2_tele = mmap.mmap(tele_file.fileno(), ctypes.sizeof(rF2data.rF2Telemetry))
ValueError: mmap length is greater than file size
setting saved
Exception ignored in: <function SimInfoSync.__del__ at 0x7fe02a58c820>
Traceback (most recent call last):
  File "/home/zapoutix/Downloads/TinyPedal-1.11.7/pyRfactor2SharedMemory/sim_info_sync.py", line 184, in __del__
    self.close()
  File "/home/zapoutix/Downloads/TinyPedal-1.11.7/pyRfactor2SharedMemory/sim_info_sync.py", line 89, in close
    self._rf2_tele.close()
AttributeError: 'NoneType' object has no attribute 'close'

I am using ArchLinux, with the lastest version of Rfactor2 (v1132)

i got all the $rFactor2SMMP_* then i do a ls /dev/shm

-rw-r--r--  1 zapoutix zapoutix    10152  1 avril 11:09 '$rFactor2SMMP_Extended$'
-rw-r--r--  1 zapoutix zapoutix       16  1 avril 11:09 '$rFactor2SMMP_ForceFeedback$'
-rw-r--r--  1 zapoutix zapoutix      272  1 avril 11:09 '$rFactor2SMMP_Graphics$'
-rw-r--r--  1 zapoutix zapoutix      116  1 avril 11:09 '$rFactor2SMMP_HWControl$'
-rw-r--r--  1 zapoutix zapoutix    39792  1 avril 11:09 '$rFactor2SMMP_MultiRules$'
-rw-r--r--  1 zapoutix zapoutix      340  1 avril 11:09 '$rFactor2SMMP_PitInfo$'
-rw-r--r--  1 zapoutix zapoutix       20  1 avril 11:09 '$rFactor2SMMP_PluginControl$'
-rw-r--r--  1 zapoutix zapoutix    45272  1 avril 11:09 '$rFactor2SMMP_Rules$'
-rw-r--r--  1 zapoutix zapoutix    45272  1 avril 11:09 '$rFactor2SMMP_RulesControl$'
-rw-r--r--  1 zapoutix zapoutix    75312  1 avril 11:09 '$rFactor2SMMP_Scoring$'
-rw-r--r--  1 zapoutix zapoutix   241680  1 avril 11:09 '$rFactor2SMMP_Telemetry$'
-rw-r--r--  1 zapoutix zapoutix      632  1 avril 11:09 '$rFactor2SMMP_Weather$'
-rw-r--r--  1 zapoutix zapoutix      628  1 avril 11:09 '$rFactor2SMMP_WeatherControl$'

Do you know how i can fix this issue .

Regards
Mathieu

I have to try the newest version yet. Probably some recent change needs to be ported. Can you use an older version until I get to fix it?

I also want to write an install script to make it easier to install and update.

commented

A fix is on the way.

For the future, I would open new issues instead of using this one for everything so I could reference them in other places.

I think this one can be closed since everything related to the port is already done.

commented

Thanks for help guys, I'll close this issue now. Please open new issue for specific issue.