Code Monkey home page Code Monkey logo

yoke's Introduction

NOTE: The following instructions are for Yoke Classic, a stable version no longer in development, and available in Google Play and F-Droid

If you want a version with customizable layouts, try Yoke WebView. Yoke WebView is for the moment only available on GitHub.

Yoke Classic (desktop client)

Accelerometer

Yoke is a hackable Android gamepad for Linux (and Windows)

Get the Android app on F-Droid, Google Play or Github.

The Linux client can be installed with

# Requires Python 3.5+ which comes pre-installed in Ubuntu 16.04 and after.
pip3 install git+https://github.com/rmst/[email protected] --upgrade

On Linux to enable Yoke to create gamepad devices we need to add a udev rule

yoke-enable-uinput  # you can find that script in the "bin" directory

(This can be undone via yoke-disable-uinput)

On Windows Yoke needs the vJoy driver. The installer can be downloaded here.

Now you can run the client with

yoke

Your computer should then show up in the Yoke app immediately if you are on the same network.

Extras

To test Yoke on Linux you can install, e.g. jstest-gtk:

sudo apt install jstest-gtk
jstest-gtk  # to run

To use Yoke effectively with SDL-based games (e.g. all games using Unreal Engine or Unity3D), you can install the SDL gamepad tool. (If the package is not found, download the tool from the website.)

sudo apt install gamepadtool
gamepadtool   # to run

Multiple virtual devices on the same machine

Each yoke process creates one virtual device. To run multiple processes on the same machine make sure to give them different --id numbers (any integer greater than 0).

Security

The communication between the Linux client and the Android app are unencrypted UDP messages. You should therefore use it in networks you trust. However, if you are not in a trusted environment you can always create one via USB or Bluetooth. Just enable USB or Bluetooth tethering on your Android device and connect your Linux computer. This will create a mini-network for just your Phone and Computer and Yoke will work as usual.

Tweaking

Changing the controller mapping and behaviour of certain axes is very simple. Have a look at bin/yoke which is the Python script that is used for the yoke command.

If you want to modify more low level stuff that's also pretty easy. The Yoke linux client basically consists of a single Python file yoke/service.py.

Thumbstick

yoke's People

Contributors

dithpri avatar jancborchardt avatar medape avatar pzmarzly avatar rmst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yoke's Issues

Yoke crash on startup

I am using Fedora 32.
After running yoke-enable-uinput I run yoke and get the following error and the app crashes:

Starting service... Press Ctrl+C to exit.
Shutting down...
Exception in thread zeroconf-Engine-32239:
Traceback (most recent call last):
  File "/usr/lib64/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/home/pmolodyk/.local/lib/python3.8/site-packages/zeroconf/__init__.py", line 1314, in run
    reader.handle_read(socket_)
  File "/home/pmolodyk/.local/lib/python3.8/site-packages/zeroconf/__init__.py", line 1396, in handle_read
    self.zc.handle_query(msg, None, _MDNS_PORT)
  File "/home/pmolodyk/.local/lib/python3.8/site-packages/zeroconf/__init__.py", line 2716, in handle_query
    DNSText(
  File "/home/pmolodyk/.local/lib/python3.8/site-packages/zeroconf/__init__.py", line 618, in __init__
    assert isinstance(text, (bytes, type(None)))
AssertionError
Traceback (most recent call last):
  File "./yoke", line 85, in <module>
    service.run()
  File "/home/pmolodyk/.local/lib/python3.8/site-packages/yoke/service.py", line 162, in run
    zeroconf.register_service(self.info, ttl=10)
  File "/home/pmolodyk/.local/lib/python3.8/site-packages/zeroconf/__init__.py", line 2419, in register_service
    self._broadcast_service(info)
  File "/home/pmolodyk/.local/lib/python3.8/site-packages/zeroconf/__init__.py", line 2459, in _broadcast_service
    DNSText(info.name, _TYPE_TXT, _CLASS_IN | _CLASS_UNIQUE, info.other_ttl, info.text), 0
  File "/home/pmolodyk/.local/lib/python3.8/site-packages/zeroconf/__init__.py", line 618, in __init__
    assert isinstance(text, (bytes, type(None)))
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./yoke", line 90, in <module>
    service.close()
  File "/home/pmolodyk/.local/lib/python3.8/site-packages/yoke/service.py", line 213, in close
    zeroconf.unregister_service(self.info)
  File "/home/pmolodyk/.local/lib/python3.8/site-packages/zeroconf/__init__.py", line 2503, in unregister_service
    out.add_answer_at_time(DNSText(info.name, _TYPE_TXT, _CLASS_IN | _CLASS_UNIQUE, 0, info.text), 0)
  File "/home/pmolodyk/.local/lib/python3.8/site-packages/zeroconf/__init__.py", line 618, in __init__
    assert isinstance(text, (bytes, type(None)))
AssertionError

Yoke OSError when executed on Manjaro

I have followed all the steps on the Github readme. I added a new group and added my self to it per yoke-enable-uinput script, with some modifications because the command to add groups and users is not for Arch. Anyway I got the group "uinput" added and I added myself to that group then make the udev rules. Command "yoke" or "sudo yoke" or "sudo /bin/yoke" produce the same error below:

Traceback (most recent call last): File "/bin/yoke", line 42, in <module> dev = yoke.Device(args.name, events=Service.events) File "/usr/lib/python3.7/site-packages/yoke/service.py", line 67, in __init__ self.device = uinput.Device(events, name, BUS_VIRTUAL) File "/usr/lib/python3.7/site-packages/uinput/__init__.py", line 178, in __init__ self.__uinput_fd = fd or fdopen() File "/usr/lib/python3.7/site-packages/uinput/__init__.py", line 84, in fdopen return _libsuinput.suinput_open() File "/usr/lib/python3.7/site-packages/uinput/__init__.py", line 70, in _open_error_handler raise OSError(code, msg) OSError: [Errno 19] Failed to open the uinput device: No such device

Pass through of BT Android gamepads?

Probably feature creep, but do you think it would be possible to pass through some Android only Bluetooth gamepads as standardized controllers in Linux? They are a pain to get working in Linux otherwise but seem to be working out of the box in Android.

request for instruction on how to compile

hello, i wish to test the latest commit on my android tablet. could you provide instructions on how to compile it to something my android device would be able to run? i would like to use linux, but i have a dual boot with windows if neccecary

Startup wont run

after running yoke-enable-uinput, followed by yoke it gives an error. have i preformed this task wrong.

UI breaks in WebView v58 (old)

Hello,

First, thanks a lot for this very promising app. The instructions using the old branch and the F-Droid app worked greatly, but unfortunately I wasn't able to use any button, making the app not usable. I think to understand that in latest versions, it is now possible to use buttons... But unfortunately I can't find how to use the latest version. Here is what I do for now:

  • I download latest version with a clone of the master branch, and I run pip3 install ..
  • I install the apk in devel/app-debug.apk
  • I install the udev rule with the script in bin/yoke-enable-uinput
  • I run yoke
  • From the android app, I connect to my computer

Then, I see several layouts (that's a great idea so far), and on the console I get:

$ yoke
Starting service... Press Ctrl+C to exit.
starting webserver on  49439 /home/leo/.local/lib/python3.7/site-packages/yoke/assets/joypad
To connect select "leodeb-Yoke-1" on your device,
or connect manually to "192.168.1.21:49439"
192.168.1.14 - - [20/Aug/2019 12:10:31] "GET /main.html HTTP/1.1" 200 -
192.168.1.14 - - [20/Aug/2019 12:10:32] "GET /base.css HTTP/1.1" 200 -
192.168.1.14 - - [20/Aug/2019 12:10:32] "GET /base.js HTTP/1.1" 200 -
192.168.1.14 - - [20/Aug/2019 12:10:32] code 404, message File not found
192.168.1.14 - - [20/Aug/2019 12:10:32] "GET /favicon.ico HTTP/1.1" 404 

and when I click on a layout (say Racing), I get a strange display, without any touchpad anymore (looks a bit strange), like that:
Screenshot_20190820-121140

And when I randomly press some buttons, yoke crash on the computer with an error:

192.168.1.14 - - [20/Aug/2019 12:11:15] "GET /racing.css HTTP/1.1" 200 -
192.168.1.14 - - [20/Aug/2019 12:11:15] "GET /img/motiontrinket.svg HTTP/1.1" 200 -
192.168.1.14 - - [20/Aug/2019 12:11:15] "GET /img/b1.svg HTTP/1.1" 200 -
Connected to  ('192.168.1.14', 42000)
Shutting down...
Traceback (most recent call last):
  File "/home/leo/.local/bin/yoke", line 17, in <module>
    service.run()
  File "/home/leo/.local/lib/python3.7/site-packages/yoke/service.py", line 313, in run
    v = self.preprocess(m, len(self.dev.events))
  File "/home/leo/.local/lib/python3.7/site-packages/yoke/service.py", line 246, in preprocess
    v = tuple([int(m) for m in v])
  File "/home/leo/.local/lib/python3.7/site-packages/yoke/service.py", line 246, in <listcomp>
    v = tuple([int(m) for m in v])
ValueError: invalid literal for int() with base 10: b'NaN'

(On the android, I can also see some numbers with one of the numbers being 'NaN', so I guess the error comes from that).

Moreover, before the crash, jstest-gtk does not detect any joystick.

Did I make a mistake? If yes, how could I get a full working yoke, with touchpads and buttons?

Thanks a lot!

Yoke binds on wrong interface / shows wrong IP when connected to VPN

When I run Yoke while connected to a VPN (VPN IP is 10.x.y.z, my local IP is 192.x.y.z):

$ yoke
Starting service... Press Ctrl+C to exit.
starting webserver on  58372 /usr/lib/python3.7/site-packages/yoke/assets/joypad
To connect select "pawel-pc-Yoke-1" on your device,
or connect manually to "10.x.y.z:58372"
^CShutting down...

The phone can see the PC, but trying to load the UI results in:

Screenshot_20190409-175840

VPN network interface is tun0, Ethernet is enp0s20f0u3u4. I won't mind having to enter IP or network interface manually.

there is no Fullscreen in yoke-webview

So i installed the devel/app-debug.apk, i have a slight annoyance with not being able to hide the title bar in the app. Please either remove the titlebar or release the source code for the android app. Love this project by the way, i adore this so much.

Me and all my college friends thank you for making our weekend nights 10x more fun.

executing yoke on Linux: OSError: [Errno 19]

Hi,
I am running on Arch Linux, kernel 4.18.10.

When executing yoke on Linux I get error number 19. I have followed all the steps on the Github readme. I added a new group and added my self to it per yoke-enable-uinput script. Any help is appreciated. The error:

Traceback (most recent call last):
File "/usr/bin/yoke", line 41, in
dev = yoke.Device(args.name, events=Service.events)
File "/usr/lib/python3.7/site-packages/yoke/service.py", line 67, in init
self.device = uinput.Device(events, name, BUS_VIRTUAL)
File "/usr/lib/python3.7/site-packages/uinput/init.py", line 178, in init
self.__uinput_fd = fd or fdopen()
File "/usr/lib/python3.7/site-packages/uinput/init.py", line 84, in fdopen
return _libsuinput.suinput_open()
File "/usr/lib/python3.7/site-packages/uinput/init.py", line 70, in _open_error_handler
raise OSError(code, msg)
OSError: [Errno 19] Failed to open the uinput device: No such device

Add working SDL_GAMECONTROLLERCONFIG to README

Since Yoke is the same across all installation, it would be useful to dump gamepadtool-generated SDL_GAMECONTROLLERCONFIG env. var. to README, so others won't have to download gamepadtool at all (unless they want to rebind keys), but just copy the text.

This could be postponed until #2 is done.

Cannot upgrade gamepads

When I connect to the server running on my laptop (Debian) with the new Android app and when I go to "Upgrade gamepad" it says:

Cleartext HTTP traffic to ip-of-my-laptop no permitted.

The Android version is 9.

Let me know if you need any other information.

Greets.
Ernesto

Connectivity issues with Yoke over Wifi

Has anyone else experienced disconnects when using yoke via Wifi? To get good connectivity? I usually use USB tethering and connect manually, which seemed to be the only way for yoke to work reliably. Perhaps it would be sensible to get rid of the UDP over IP communication and instead use direct USB (and potentially bluetooth).

As soon as the app connects the desktop client crashes

The desktop client does start, and is recognized by the app but as soon as it tries to connect the desktop client crashes giving these errors:

Shutting down…
Traceback (most recent call last):
File "/home/matteo/.local/lib/python3.7/site-packages/yoke/service.py", line 364, in run
v = self.preprocess(m, len(self.dev.events))
File "/home/matteo/.local/lib/python3.7/site-packages/yoke/service.py", line 288, in preprocess
v = tuple([int(m) for m in v])
File "/home/matteo/.local/lib/python3.7/site-packages/yoke/service.py", line 288, in
v = tuple([int(m) for m in v])
ValueError: invalid literal for int() with base 10: b' 5.374597 -0.856031 8.157899 0.0 0.0 0.0 0.0'

Steps to reproduce:
1: Install the Yoke app and desktop client using the instructions at https://github.com/rmst/yoke/blob/master/WEBVIEW.md
2: Start the Yoke client and app
3: Connect the app to client

Specifications:
PC: Ubuntu 19.10
Phone: Xiaomi Redmi Note 9, MIUI Global 12.0.4 Stable (Android 10)

Startup error

I followed all the readme, and got stuck with this error, maybe I need to load a kernel module?:

python3 bin/yoke
Traceback (most recent call last):
File "bin/yoke", line 80, in
dev = yoke.Device(args.id, args.name, events=Service.events)
File "/home/jose/.local/lib/python3.8/site-packages/yoke/service.py", line 73, in init
self.device = uinput.Device(events, name, BUS_VIRTUAL)
File "/home/jose/.local/lib/python3.8/site-packages/uinput/init.py", line 178, in init
self.__uinput_fd = fd or fdopen()
File "/home/jose/.local/lib/python3.8/site-packages/uinput/init.py", line 84, in fdopen
return _libsuinput.suinput_open()
File "/home/jose/.local/lib/python3.8/site-packages/uinput/init.py", line 70, in _open_error_handler
raise OSError(code, msg)
OSError: [Errno 19] Failed to open the uinput device: No such device

numpy missing

I'm getting this error, I think numpy is missing

Traceback (most recent call last):
  File "/usr/local/bin/yoke", line 2, in <module>
    import yoke
  File "/usr/local/lib/python3.6/dist-packages/yoke/__init__.py", line 1, in <module>
    from yoke.service import Device, Service, GAMEPAD_EVENTS, EVENTS
  File "/usr/local/lib/python3.6/dist-packages/yoke/service.py", line 12, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'

Arbitrary controller layouts via html / javascript

I think it would be good to make the app ui webview based. It should load a html + javascript file from the machine it connects to. The loaded html + javascript then send back commands to the connected machine through a simple webview java interface in Android. It would make the app much more powerful. Anyone could make their own controller layouts including buttons. What I am missing right now is a multitouch enabled html/javascript virtual joystick.

Windows support

If I understand it correctly, the desktop app is basically a vjoy feeder.

Upon installing and running it, I get an error like this:

PS C:\Python38\Scripts> python .\yoke
Warning: This is not well tested on Windows!
Checking files on webserver… OK.
Writing manifest… OK.
Starting webserver on  64780 C:\Python38\lib\site-packages\yoke\assets\joypad

To connect select "rift-Yoke-1" on your device,
or connect manually to "10.91.1.112:64780"
Press Ctrl+C to exit.
Connected to  ('10.91.1.181', 37319)
Shutting down…
Traceback (most recent call last):
  File ".\yoke", line 17, in <module>
    service.run()
  File "C:\Python38\lib\site-packages\yoke\service.py", line 350, in run
    v = self.preprocess(m, len(self.dev.events))
  File "C:\Python38\lib\site-packages\yoke\service.py", line 281, in preprocess
    v = tuple([int(m) for m in v])
  File "C:\Python38\lib\site-packages\yoke\service.py", line 281, in <listcomp>
    v = tuple([int(m) for m in v])
ValueError: invalid literal for int() with base 10: b' -0.17202751 0.835325 9.769495 0.0 0.0 0.0 0.0'

I can help with the testing but my Python (or any programming) knowledge is limited.

Non-ASCII character '\xe2' in file

Hello, i tried to run yoke on Ubuntu Mate. But, when i type python yoke. It prints this error:

Traceback (most recent call last): File "yoke", line 4, in <module> import yoke File "/home/fabio/.local/lib/python2.7/site-packages/yoke/__init__.py", line 1, in <module> from yoke.service import Device, Service, EVENTS File "/home/fabio/.local/lib/python2.7/site-packages/yoke/service.py", line 112 SyntaxError: Non-ASCII character '\xe2' in file /home/fabio/.local/lib/python2.7/site-packages/yoke/service.py on line 112, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Add on F-droid

Could be great to add the android app on the f-droid catalogue.

Linux - Steam Dirt Rally 1: Is not detecting right tilt?

System information:
OS: Arch Linux x86_64
Kernel 4.18...-arch1-1-Arch
Game: Dirt Rally 1 - Steam edition, native support - non wine...

Issue:
The game does not detect tilting to the right, when setting key binds using keyboard and mouse profile, however, left tiling is detected. Can not test in joystick profile as the game uses "Y" axis of joystick to scroll up/down options. As result, the game scrolls up/down really fast.

What I have tried:
"jtest-gtk" was able to detect the joystick, all axis were calibrated and indicated they were functional. Also tried to remap axis but unsuccessful, did not help. I had the steam client and game client up-to-date and restarted the PC one.

Feature Request:
It would be handy to pause the inputs from the joystick without disconnecting it so that it would be possible to set keybindings. This would prevent the game from scrolling down/up options. However, I do not think this would resolve my problem.

Please let me know if you need further information. Thanks in advance.

Crash after establishing connection to android

System:
ubuntu 20.04
android 10

after connecting from the phone, following console output appears, the float values varying each time:

`Checking files on webserver… OK.
Writing manifest… OK.
Starting webserver on 42245 /home/hochmax/.local/lib/python3.8/site-packages/yoke/assets/joypad

To connect select "ROSguide-Yoke-1" on your device,
or connect manually to "192.168.43.130:42245"
Press Ctrl+C to exit.
Connected to ('192.168.43.1', 35039)
Shutting down…
Traceback (most recent call last):
File "/home/hochmax/.local/lib/python3.8/site-packages/yoke/service.py", line 364, in run
v = self.preprocess(m, len(self.dev.events))
File "/home/hochmax/.local/lib/python3.8/site-packages/yoke/service.py", line 288, in preprocess
v = tuple([int(m) for m in v])
File "/home/hochmax/.local/lib/python3.8/site-packages/yoke/service.py", line 288, in
v = tuple([int(m) for m in v])
ValueError: invalid literal for int() with base 10: b' 8.0252 -0.36389998 5.6243 0.0 0.0 0.0 0.0'`

Failed on Kubuntu 18.10: No module named 'uinput'

I've runned the yoke-enable-uinput, which went just fine but when i try to run the yoke script it gives me this error: ModuleNotFoundError: No module named 'uinput'.
Which occurs in the yoke/service.py file on line 71.

Input latency on Windows

From #56:

It also helps on Windows but the latency is still noticeable, around 2 or 3 tenths of second. There's still a lot to investigate on this.

Failed to open the uinput device: No such device

Followed instruction on Raspberry pi OS with everything updated on a Raspberry Pi 4
when running yoke, getting this

      Traceback (most recent call last):
        File "/home/virusz4274/.local/bin/yoke", line 80, in <module>
          dev = yoke.Device(args.id, args.name, events=Service.events)
        File "/home/virusz4274/.local/lib/python3.7/site-packages/yoke/service.py", line 73, in __init__
          self.device = uinput.Device(events, name, BUS_VIRTUAL)
        File "/home/virusz4274/.local/lib/python3.7/site-packages/uinput/__init__.py", line 178, in __init__
          self.__uinput_fd = fd or fdopen()
        File "/home/virusz4274/.local/lib/python3.7/site-packages/uinput/__init__.py", line 84, in fdopen
          return _libsuinput.suinput_open()
        File "/home/virusz4274/.local/lib/python3.7/site-packages/uinput/__init__.py", line 70, in _open_error_handler
          raise OSError(code, msg)
      OSError: [Errno 19] Failed to open the uinput device: No such device

"Nothing" on Slackware

I just installed the client on a Slackware64 -current machine. Pip3 installed everything flawlessly, but I had to manually add the udev rule (there's no addgroup command in slackware, we use groupadd, and personally I prefer not to use sudo). I can start the server correctly: it stands echoing

Starting service... Press Ctrl+C to exit.
To connect, select "zion.inet-Yoke" on your device.

but the app on my phone keeps saying "connect to nothing".

Motion controls stopped working after Android System WebView 76 update

Fun fact: Yoke was created as no phone-as-PC-gamepad app on the Play Store used to capture device movement.

onDeviceOrientation events are never fired now

Details: #38 (comment)

If you are affected by this, please try downgrading ASW for now and describe your results here.

From Chrome DevTools (remote device inspection over ADB):

[Deprecation] The devicemotion event is deprecated on insecure origins and will be removed in M76, around July 2019. Event handlers can still be registered but are no longer invoked since M74, around April 2019. See https://www.chromestatus.com/feature/5688035094036480 for more details.

Suggestion from Google announcement "deprecation proposal":

On a local network, you can test on your Android device using port forwarding to access a remote host as localhost.

... which sucks as phone would usually need to be connected over USB (ADB over Wifi is disabled by most vendor overlays).

Perhaps we could add a proxy server hosted on the phone (since localhost is a secure origin) but this seems like a lot of work. It would be a easier to download the files to the phone (I hope file:// is a secure origin, but am I right?).

Apparently we cannot unconditionally accept unsigned certs, even for LAN, since 2016, if we want the app to be on the Play Store (and, AFAIK, as it's usually the case with Google, there is no appeal process where we could explain it's LAN connection). Maybe we could add "certificate error" dialog that users would need to click through every time they open the app, just to satisfy Play Store algorithms.

Another option is to once again fetch orientation events in Java code and everything else in JS, but I'd like to avoid that.

Personally, I'd go for downloading files to phone storage, but I'd like to hear your opinions.

Add gamepad buttons

This is a very cool concept! However to be usable in vast majority of games, one would need at least A, B, X, Y buttons. Best of luck with the project. :)

Support multiple devices

Great app, but would be perfect, when it supports more then one devices to play with friends.

Android app improvements, multiple layouts problem

In Android small improvements right now would be:

  • a reconnect button
  • correct IP should be based on zeroconf data (using IP from zeroconf and port received from Yoke instead of IP:port combo from Yoke) - another method to deal with multiple interfaces would be fine too. Then --iface option could be removed or modified (despite its name Yoke always binds on 0.0.0.0, the option sets which PC interface is accessible from app's point of view)
  • stop appending 3 floats to each message (that's like 54 bytes wasted per message. doesn't sound much but I can imagine some routers struggling) - corresponding code on Python side is marked for removal with TODO: comment
  • after reconnecting (or connecting do different machine), Yoke app keeps sending status from before the reconnect, until some layout is selected (so that update_vals is called)

Multiple layouts: navigation

Right now hitting Back makes the app quit. It could instead bring user back to layout selection screen. However, currently app makes it impossible to achieve on HTML/JS side alone.

Navigating with <a href="..."> causes browser selector to pop up:

Screenshot_20190713-203220

Meanwhile I made history.pushState-based system that in browser, but in app the back button event gets intercepted by app (HTML doesn't get any event)

Multiple layouts: management

Right now some settings are adjustable in base.js. Also, since layout is hardcoded in Python code, and some programs ignore SDL gamepad string, user may want to customize Python code. This is fine (I adjusted README to show this better), but a bit troublesome.

User may want VIBRATE_ON_PAD_BOUNDARY to be on on gamepad layout, but not on racing layout. If they ever create custom layouts, there would be even more problems. There are few solutions I can think of:

  1. Move these 2 new boolean settings to CSS - but that would make 3 options per joystick (locking? vibrating on quadrants? vibrating on edges?), which means 8 joystick types (+ number) instead of current 2 (locking or non-locking).
  2. Move all settings to JSON files. We could have it like [{type:'joystick',id:1,locking:true,vibrate_on_pad_boundary:false,x:100,y:300,background:'file.svg'},{type:'joystick',id:2, ...}]. Default options of course wouldn't need to be specified. It wouldn't have to be JSON, could be e.g. TOML. We would need either a good editor, or at least a reference (list of all widgets with their default options).
  3. Move back to single layout system and tell users to use Git branches for different configs. That would let them customize Python code. If they chose not do modify Python code, they could have hot-reloading with pip3 install -e . (symlinks instead of copying files). Versioned config files could be a plus, too. The downside is that Git is not newbie-friendly. We could make some helpers, e.g.
yoke new gamepad csgo -> git checkout gamepad && git checkout -b csgo # default gamepad preset would be a branch
yoke save -> git add ${YOKE_ROOT_DIR} && git commit -m $(date)
yoke list -> git branch
yoke history csgo -> git log --oneline csgo # branch is optional
yoke set csgo -> git checkout csgo
yoke rm csgo -> git branch -D csgo

In the third scenario, Multiple layouts: navigation part could turn out to be unnecessary.

@medape @rmst : your opinions are welcome

AttributeError: 'int' object has no attribute 'items'

Here's the output when I run it on my system.

$ yoke --id 1
Starting service... Press Ctrl+C to exit.
Shutting down...
Traceback (most recent call last):
  File "/usr/local/bin/yoke", line 85, in <module>
    service.run()
  File "/home/haltosan/.local/lib/python3.10/site-packages/yoke/service.py", line 161, in run
    self.info = ServiceInfo(stype, fullname, socket.inet_aton(adr), port, 0, 0, {}, fullname)
  File "/home/haltosan/.local/lib/python3.10/site-packages/zeroconf/_services/info.py", line 143, in __init__
    self._set_properties(properties)
  File "/home/haltosan/.local/lib/python3.10/site-packages/zeroconf/_services/info.py", line 241, in _set_properties
    for key, value in properties.items():
AttributeError: 'int' object has no attribute 'items'

I'm running Ubuntu 22.04, python3.10, pip 22.0.2. I ran the pip install command in the readme. I also ran the yoke-enable-uinput executable.

Failed to open the uinput device: Permission denied

After the seemingly successful installation via pip3 and adding the udev rule I get this:

jan@Rechenknecht:~$ yoke
Traceback (most recent call last):
  File "/home/jan/.local/bin/yoke", line 41, in <module>
    dev = yoke.Device(args.name, events=Service.events)
  File "/home/jan/.local/lib/python3.6/site-packages/yoke/service.py", line 67, in __init__
    self.device = uinput.Device(events, name, BUS_VIRTUAL)
  File "/home/jan/.local/lib/python3.6/site-packages/uinput/__init__.py", line 178, in __init__
    self.__uinput_fd = fd or fdopen()
  File "/home/jan/.local/lib/python3.6/site-packages/uinput/__init__.py", line 84, in fdopen
    return _libsuinput.suinput_open()
  File "/home/jan/.local/lib/python3.6/site-packages/uinput/__init__.py", line 70, in _open_error_handler
    raise OSError(code, msg)
PermissionError: [Errno 13] Failed to open the uinput device: Permission denied
jan@Rechenknecht:~$ sudo yoke
[sudo] password for jan: 
sudo: yoke: command not found

Any idea?

Yoke Crash on Startup

Starting service... Press Ctrl+C to exit.
Shutting down...
Traceback (most recent call last):
  File "/usr/local/bin/yoke", line 85, in <module>
    service.run()
  File "/usr/local/lib/python3.8/site-packages/yoke/service.py", line 162, in run
    zeroconf.register_service(self.info, ttl=10)
  File "/usr/local/lib/python3.8/site-packages/zeroconf/__init__.py", line 2385, in register_service
    self._broadcast_service(info)
  File "/usr/local/lib/python3.8/site-packages/zeroconf/__init__.py", line 2425, in _broadcast_service
    DNSText(info.name, _TYPE_TXT, _CLASS_IN | _CLASS_UNIQUE, info.other_ttl, info.text), 0
  File "/usr/local/lib/python3.8/site-packages/zeroconf/__init__.py", line 613, in __init__
    assert isinstance(text, (bytes, type(None)))
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/yoke", line 90, in <module>
    service.close()
  File "/usr/local/lib/python3.8/site-packages/yoke/service.py", line 213, in close
    zeroconf.unregister_service(self.info)
  File "/usr/local/lib/python3.8/site-packages/zeroconf/__init__.py", line 2469, in unregister_service
    out.add_answer_at_time(DNSText(info.name, _TYPE_TXT, _CLASS_IN | _CLASS_UNIQUE, 0, info.text), 0)
  File "/usr/local/lib/python3.8/site-packages/zeroconf/__init__.py", line 613, in __init__
    assert isinstance(text, (bytes, type(None)))
AssertionError

installed with pip3, ran the yoke-enable-uinput script

Fedora 32

Can't run on Windows 10

Hi! When I try to run it on Windows 10 as Administrator, I get error:

C:\Program Files\Python37\Scripts>python yoke Traceback (most recent call last): File "yoke", line 79, in <module> dev = yoke.Device(args.name, events=Service.events) File "C:\Program Files\Python37\lib\site-packages\yoke\service.py", line 100, in __init__ self.device = VjoyDevice(1) File "C:\Program Files\Python37\lib\site-packages\yoke\vjoy\vjoydevice.py", line 32, in __init__ self.lib = cdll.LoadLibrary(lib_path) File "C:\Program Files\Python37\lib\ctypes\__init__.py", line 434, in LoadLibrary return self._dlltype(name) File "C:\Program Files\Python37\lib\ctypes\__init__.py", line 356, in __init__ self._handle = _dlopen(self._name, mode) OSError: [WinError 126] The specified module could not be found

Please, help, I want to try it! :)

I got error when run "yoke.py" in bin folder

every run "yoke.py" in the bin folder said:

Traceback (most recent call last):
  File "/home/alr86/.local/lib/python3.11/site-packages/yoke/./yoke", line 2, in <module>
    import yoke
  File "/home/alr86/.local/lib/python3.11/site-packages/yoke/__init__.py", line 1, in <module>
    from yoke.service import Device, Service, EVENTS
  File "/home/alr86/.local/lib/python3.11/site-packages/yoke/service.py", line 13, in <module>
    import uinput
  File "/home/alr86/.local/lib/python3.11/site-packages/uinput/__init__.py", line 86, in <module>
    _libsuinput_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "_libsuinput" + sysconfig.get_config_var("SO")))
                                                                                     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str

Better name for the Python module

There's a different module called yoke on the Python Package Index. It appears to be some kind of middleware for Amazon Webservers.

Whatever it is, it makes it difficult to install that and our yoke at the same time. It's also easy to accidentally type pip3 install yoke and install that module by mistake.

I think the name for this project should be changed, at least within setup.py. Maybe yoke-pc or yoke-gamepad?

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.