Git Product home page Git Product logo

Comments (35)

Cleric-K avatar Cleric-K commented on August 24, 2024 3

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:

  1. Create a directory and create in it a mwjoy.py file with this contents.
  2. Create another file in the same directory called msp.py with this contents.
  3. Install pip if not present. sudo apt-get install python-pip if you are on a debian based distro.
  4. Execute pip install python-uinput
  5. Go to the directory you created and execute sudo python mwjoy.py SERIAL_DEV where you replace SERIAL_DEV with the serial device (/dev/ttyUSB0, /dev/ttyACM0 or something like that).
  6. While the script is running you should have a virtual joystick.

Let me know if that works.

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

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.

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

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 ;)

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

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 ;)

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

Oh, I forgot: you also need pip install pyserial

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

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
with uinput.Device(events) as device:
File "/usr/local/lib/python2.7/dist-packages/uinput/init.py", line 178, in init
self.__uinput_fd = fd or fdopen()
File "/usr/local/lib/python2.7/dist-packages/uinput/init.py", line 84, in fdopen
return _libsuinput.suinput_open()
File "/usr/local/lib/python2.7/dist-packages/uinput/init.py", line 68, in _open_error_handler
raise OSError(code, "%s. Perhaps load the uinput kernel module first?" % msg)
OSError: [Errno 2] Failed to open the uinput device: No such file or directory. Perhaps load the uinput kernel module first?

I am having issues connecting the board to betaflight also...so may be that the reason
hope I did all good and this helps

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

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

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

Also a msp.pyc was created in the directory, binary values.

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

The error is because the uinput device does not exists. What linux distro are you using?
Try sudo modprobe uinput

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

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? :)

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

Does it work in your sim now? (while the script is running of course)

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

no, it is not detected in velocidrone

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

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.

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

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

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

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?

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

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

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

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.

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

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?

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

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.

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

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

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

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

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

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.

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

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

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

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! :)

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

Hi @cprpolo ,
Are you interested in trying out a linux port of vJSF?

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

Ok, don't worry, anytime you can.
I'll try to prepare a build today.

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

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.

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

Hi,

I've uploaded a new release. It should support Linux. You can check it out.

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

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.

from vjoyserialfeeder.

cprpolo avatar cprpolo commented on August 24, 2024

from vjoyserialfeeder.

Cleric-K avatar Cleric-K commented on August 24, 2024

Hi,
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.

from vjoyserialfeeder.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.