Closed cprpolo closed 6 years ago
Hi, the c# code compiles as a .NET executable so in theory it should run on any platform with Mono for example. But the problem is that vJoy is a Windows driver - does not work on anything else. If something analogous to vJoy is found for linux it could be possible I guess.
The problem is similar with MacOS.
I'll have to take a look. Hi, the c# code compiles as a .NET executable so in theory it should run on any platform with Mono for example. But the problem is that vJoy is a Windows driver - does not work on anything else. If something analogous to vJoy is found for linux it could be possible I guess.
The problem is similar with MacOS.
I'll have to take a look.
I guessed that. I found this : https://github.com/izissise/Linux-Virtual-Joystick-cpp Pretty old but may be helpful. Thank you for taking a look ;)
I guessed that. I found this : https://github.com/izissise/Linux-Virtual-Joystick-cpp Pretty old but may be helpful. Thank you for taking a look ;)
Hi, I don't know when or if I'll be able to port the actual vJoySerialFeeder to Linux, but I've created a simple script that might help you. I hope you find your way in Linux because there are some steps:
mwjoy.py
file with this contents.msp.py
with this contents.pip
if not present. sudo apt-get install python-pip
if you are on a debian based distro.pip install python-uinput
sudo python mwjoy.py SERIAL_DEV
where you replace SERIAL_DEV
with the serial device (/dev/ttyUSB0
, /dev/ttyACM0
or something like that).Let me know if that works.
Oh, I forgot: you also need pip install pyserial
hi, thanks very much for looking into this.
Here is what i got:
~/Documents/vjoy$ sudo python mwjoy.py /dev/ttyACM0
Waking up board on /dev/ttyACM0...
1
Traceback (most recent call last):
File "mwjoy.py", line 18, in
I am having issues connecting the board to betaflight also...so may be that the reason hope I did all good and this helps
Okay, after another board's tests seems that when i plugged the board i can connect to betaflight no issues. When i run the script, i get the error above and after that the connection to betaflight is intermittent (not always connects) if I unplug the usb and plug it again, i may get a different ttyUSBx or ttyACMx, but same behavior
I'll test more if i can thanks
Also a msp.pyc was created in the directory, binary values.
The error is because the uinput
device does not exists. What linux distro are you using?
Try sudo modprobe uinput
okay, after doing sudo modprobe uinput worked ~/Documents/vjoy$ sudo python mwjoy.py /dev/ttyUSB0 Waking up board on /dev/ttyUSB0... 1 working ... That's great :) what else should i try? :)
Does it work in your sim now? (while the script is running of course)
no, it is not detected in velocidrone
Hmm.. I have tested with jstest-gtk
and it finds it.
Can you install it and give it a try?
Also, while you are running you should see in /dev/input/
something like js0
.
just tested it, it appears as js1, but it is not detected. i am using debian btw, any possible permissions issue? jstest-gtk with sudo does not make any difference
I don't really know. I'm testing with Ubuntu 16.04 here.
What about: jstest /dev/input/js1
with or without sudo
(it's in the joystick
package, if you don't have it installed).
Another test is hd /dev/input/js1
this should dump hex values of the raw joystick events. They should be running all the time. Stop with Ctrl-C
.
What Deb release/kernel version?
jstest-gtk /dev/input/js1 Gtk-Message: Failed to load module "canberra-gtk-module"
(jstest-gtk:3786): GLib-GObject-WARNING **: value "0" of type 'guint' is invalid or out of range for property 'n-columns' of type 'guint' Warning: unknown joystick, not displaying graphical representation
that's what i get in the terminal, but in the gui no movement Debian 8 Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u5 (2017-09-19) x86_64 GNU/Linux
No, not jstest-gtk
, just jstest
- that's cli program.
Try also to replace mw.py
with this version. It adds on line 22 a print
. It should dump the multiwii packets as they are read from the fc.
i think is working without the new version that you just posted. But can't get it in velocidrone and the yaw is not working At this point i think it is something in my pc, i need more time to check it, is it working for you? my pc keeps changing the uarts for some reason, i think that's the issue...did you test velocidrone? maybe someone else can test on linux?
Check this again. I changed the axes. Also put a button just in case (although it is not used).
When you run the debug version do you see stuff like:
{'throttle': 1504, 'timestamp': '1520885596.43', 'yaw': 1504, 'elapsed': 0.01, 'pitch': 1504, 'roll': 1504}
{'throttle': 1504, 'timestamp': '1520885596.44', 'yaw': 1504, 'elapsed': 0.01, 'pitch': 1504, 'roll': 1504}
{'throttle': 1504, 'timestamp': '1520885596.45', 'yaw': 1504, 'elapsed': 0.01, 'pitch': 1504, 'roll': 1504}
{'throttle': 1504, 'timestamp': '1520885596.46', 'yaw': 1504, 'elapsed': 0.01, 'pitch': 1504, 'roll': 1504}
{'throttle': 1504, 'timestamp': '1520885596.47', 'yaw': 1504, 'elapsed': 0.01, 'pitch': 1504, 'roll': 1504}
Where do you see the yaw not working? I the debug output or in the jtest
output?
I don't have any games on this linux so I can't test. I'll download fpvfreerider linux demo now and see.
Works fine in freerider.
cleric@ubuntu:~/games/FpvFreerider$ ./FPVFreerider_demo.x86_64
Set current directory to /home/cleric/games/FpvFreerider
Found path: /home/cleric/games/FpvFreerider/FPVFreerider_demo.x86_64
Mono path[0] = '/home/cleric/games/FpvFreerider/FPVFreerider_demo_Data/Managed'
Mono path[1] = '/home/cleric/games/FpvFreerider/FPVFreerider_demo_Data/Mono'
Mono config path = '/home/cleric/games/FpvFreerider/FPVFreerider_demo_Data/Mono/etc'
displaymanager : xrandr version warning. 1.5
client has 1 screens
displaymanager screen (0)(default): 1280 x 1024
Using libudev for joystick management
Importing game controller configs
/dev/input/js0: driver version: 2.1.0 (20100)
/dev/input/js0: fd 4, buttons 0, axes 4, name python-uinput
/dev/input/js0: axis 0: raw 65, mapped 0.000000
/dev/input/js0: axis 1: raw 0, mapped 0.000000
/dev/input/js0: axis 2: raw -32767, mapped 0.000000
/dev/input/js0: axis 3: raw 131, mapped 0.000000
Assigning joystick 1
hi, I can see it in velocidrone, i updated the debian and rebooted. The yaw is not working though, either in jtest or the velocidrone, however in the debug i can see it changing I'll try fpv Freerider also thank you for your work
That's strange. Here's something to try: at the lines:
device.emit(uinput.ABS_X, (state['roll']-1500)*32767/500, syn=False)
device.emit(uinput.ABS_Y, (state['pitch']-1500)*32767/500, syn=False)
device.emit(uinput.ABS_Z, (state['throttle']-1500)*32767/500, syn=False)
device.emit(uinput.ABS_RX , (state['yaw']-1500)*32767/500)
Exchange for example ABS_X
with ABS_RX
. If the problem is in the RX axis, then it should stop working for roll and start working for yaw. I yaw does not work again, then maybe the problem will be in the emit
itself, which will be odd.
okay... got it... the indentation on the last line (yaw one) was bad and the if was not taking it... moved it and it is working now! :) thank you very much!!! works great in velocidrone! thank you
Well, that's great news!
I'm glad it worked out. Now that we know that the uinput
device can do the job, I'll see if I can implement it in vjoyserialfeeder.
People are also interested in MacOS, but this is even more distant goal - since I've never even used a Mac :) let alone programmed for it.
One last thing: If you haven't done so, you can comment (#
) or remove the print(state)
line. It will save you a few CPU cycles.
Happy flying! :)
Great job! Thank you
On 12 Mar 2018 7:22 am, "Cleric-K" notifications@github.com wrote:
The error is because the uinput device does not exists. What linux distro are you using? Try sudo modprobe uinput
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Cleric-K/vJoySerialFeeder/issues/5#issuecomment-372214393, or mute the thread https://github.com/notifications/unsubscribe-auth/AOhEpnpzNdc3OzAoJjKIT_ucO7YWxoL6ks5tdiIxgaJpZM4SlN8I .
Hi @cprpolo , Are you interested in trying out a linux port of vJSF?
Sure! I am a bit tight with time but yeah :)
On 23 Mar 2018 12:01 pm, "Cleric-K" notifications@github.com wrote:
Hi @cprpolo https://github.com/cprpolo , Are you interested in trying out a linux port of vJSF?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Cleric-K/vJoySerialFeeder/issues/5#issuecomment-375644036, or mute the thread https://github.com/notifications/unsubscribe-auth/AOhEpoH2SktMcowVULWQ0jgrFgUmoeNCks5thOQbgaJpZM4SlN8I .
Ok, don't worry, anytime you can. I'll try to prepare a build today.
Grand :) thanks
On 23 Mar 2018 12:07 pm, "Cleric-K" notifications@github.com wrote:
Ok, don't worry, anytime you can. I'll try to prepare a build today.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Cleric-K/vJoySerialFeeder/issues/5#issuecomment-375645181, or mute the thread https://github.com/notifications/unsubscribe-auth/AOhEphFMWAPbUAvsftoft7huGIK5gGxUks5thOVkgaJpZM4SlN8I .
Alright, here are some binaries: https://www.dropbox.com/sh/0jhgb2tmyzd6ffh/AADFS1xkD0YWIc3C_gwl1ABqa?dl=0
Since vjsf is written in C# in needs .NET Runtime - for linux that is Mono.
The two files vJoySerialFeeder_32
and .._64
are bundles which are native ELF executables and they should contain all the necessary runtime stuff inside (that's why they are so big). You'll have to do chmod +x ...
If you have mono installed you can simply: mono vJoySerialFeeder.exe
If you want to run as non-root, you'll have to do something like sudo chmod a+wr /dev/uinput
(this will be reset to the default on reboot). There is a more elegant way ( https://tkcheng.wordpress.com/2013/11/11/changing-uinput-device-permission/ ) but chmod is faster if you just want to make the test.
You also have to make sure your user is part of the dialout
group if you want to be able to access serial ports as non-root.
Hi,
I've uploaded a new release. It should support Linux. You can check it out.
Sorry I did not have time, would u be able to zip it with 7zip also? Tar.gz is giving me issues for some reason. Thanks
On Fri, 23 Mar 2018, 14:42 Cleric-K, notifications@github.com wrote:
Alright, here are some binaries: https://www.dropbox.com/sh/0jhgb2tmyzd6ffh/AADFS1xkD0YWIc3C_gwl1ABqa?dl=0
Since vjsf is written in C# in needs .NET Runtime - for linux that is Mono.
The two files vJoySerialFeeder_32 and .._64 are bundles which are native ELF executables and they should contain all the necessary runtime stuff inside (that's why they are so big). You'll have to do chmod +x ...
If you have mono installed you can simply: mono vJoySerialFeeder.exe
If you want to run as non-root, you'll have to do something like sudo chmod a+wr /dev/uinput (this will be reset to the default on reboot). There is a more elegant way ( https://tkcheng.wordpress.com/2013/11/11/changing-uinput-device-permission/ ) but chmod is faster if you just want to make the test. You also have to make sure your user is part of the dialout group if you want to be able to access serial ports as non-root.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Cleric-K/vJoySerialFeeder/issues/5#issuecomment-375687266, or mute the thread https://github.com/notifications/unsubscribe-auth/AOhEplUvnjB5mmKi48NqBe8zoDmmjZwPks5thQnegaJpZM4SlN8I .
Hi, here's a 7z file https://www.dropbox.com/s/qr6vc5osjah0q5i/vjsf_linux.7z?dl=0 I used tar because it preserves file attributes. Now you'll have to manually set the standalone files to executable after extract.
Hi, thank you for your email. I am getting: ./vJoySerialFeeder_standalone_64
Unhandled Exception: System.TypeInitializationException: The type initializer for 'System.Windows.Forms.XplatUI' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception. ---> System.DllNotFoundException: libgdiplus.so at (wrapper managed-to-native) System.Drawing.GDIPlus.GdiplusStartup(ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&) at System.Drawing.GDIPlus..cctor () [0x000b0] in
<8c8f672d8fd740338ad9b07c40442887>:0 --- End of inner exception stack trace --- at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr) at System.Drawing.Graphics.FromHdcInternal (System.IntPtr hdc) [0x00000] in <8c8f672d8fd740338ad9b07c40442887>:0 at System.Windows.Forms.XplatUIX11.SetDisplay (System.IntPtr display_handle) [0x00073] in <5bce9e20eced4770960bd97a1070c633>:0 at System.Windows.Forms.XplatUIX11..ctor () [0x00077] in <5bce9e20eced4770960bd97a1070c633>:0 at System.Windows.Forms.XplatUIX11.GetInstance () [0x00019] in <5bce9e20eced4770960bd97a1070c633>:0 at System.Windows.Forms.XplatUI..cctor () [0x00066] in <5bce9e20eced4770960bd97a1070c633>:0 --- End of inner exception stack trace --- at System.Windows.Forms.Application.EnableVisualStyles () [0x00006] in <5bce9e20eced4770960bd97a1070c633>:0 at vJoySerialFeeder.Program.Main (System.String[] args) [0x00000] in <52842dd8da3d4f59aa8ad5b8cf8bf553>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'System.Windows.Forms.XplatUI' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Drawing.GDIPlus' threw an exception. ---> System.DllNotFoundException: libgdiplus.so at (wrapper managed-to-native) System.Drawing.GDIPlus.GdiplusStartup(ulong&,System.Drawing.GdiplusStartupInput&,System.Drawing.GdiplusStartupOutput&) at System.Drawing.GDIPlus..cctor () [0x000b0] in <8c8f672d8fd740338ad9b07c40442887>:0 --- End of inner exception stack trace --- at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr) at System.Drawing.Graphics.FromHdcInternal (System.IntPtr hdc) [0x00000] in <8c8f672d8fd740338ad9b07c40442887>:0 at System.Windows.Forms.XplatUIX11.SetDisplay (System.IntPtr display_handle) [0x00073] in <5bce9e20eced4770960bd97a1070c633>:0 at System.Windows.Forms.XplatUIX11..ctor () [0x00077] in <5bce9e20eced4770960bd97a1070c633>:0 at System.Windows.Forms.XplatUIX11.GetInstance () [0x00019] in <5bce9e20eced4770960bd97a1070c633>:0 at System.Windows.Forms.XplatUI..cctor () [0x00066] in <5bce9e20eced4770960bd97a1070c633>:0 --- End of inner exception stack trace --- at System.Windows.Forms.Application.EnableVisualStyles () [0x00006] in <5bce9e20eced4770960bd97a1070c633>:0 at vJoySerialFeeder.Program.Main (System.String[] args) [0x00000] in <52842dd8da3d4f59aa8ad5b8cf8bf553>:0 What am I missing? thanks Carlos 2018-04-16 22:09 GMT+01:00 Cleric-KHi,
I did some tests and it turns out that these standalone versions are not going to work. Seems that the native libraries are still needed to be installed locally. For example, in your case libgdiplus.so
is needed. I tried to include that into the standalone bundle but then libgdiplus.so
itself has still other dependencies and so on.
So I guess I'll remove the standalone versions from the releases.
In that case the only solution left is to install Mono.
If you are interested you'll have to follow the instructions at https://www.mono-project.com/download/stable/#download-lin-debian for your platform, then download the mono release of vjsf and start from console with mono vJoySerialFeeder.exe
.
But if you don't want to go through all this - it is fine, don't waste your time.
Hi, is there any chance of an executable for linux (rpm or deb)? mainly interested in the multiwii part where you use the Flight controller connected to the PC. or any advice for compilation if it would be doable with the same code?
Thank you for this work :)