Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General usage #1

Closed
baracudaz opened this issue Jan 14, 2017 · 3 comments
Closed

General usage #1

baracudaz opened this issue Jan 14, 2017 · 3 comments

Comments

@baracudaz
Copy link

baracudaz commented Jan 14, 2017

Hi @dillbyrne

Thanks for your work! I am trying to integrate my OSMC with RetroPie. Idea controlling the both OSMC/Kodi and EmulationStation/RetroPie with a single remote via HDMI/CEC is definitely appealing. However I have some general usage issues with your script.

I believe I have managed to install all the dependencies. Added missing /etc/udev/rules.d/40-uinput.rules and confirmed the script works in background with evtest tool.

However I still cannot control the EmulationStation. ES is stuck waiting for a controller.

Any ideas?

@dillbyrne
Copy link
Owner

dillbyrne commented Jan 14, 2017

Hi @baracudaz . I'm using retropie 4.1 and I have only tested it with that version of ES.
the file /etc/udev/rules.d/40-uinput.rules should have been installed by the python-uinput package. So I can't say for sure if it will be guaranteed to work on other distros without some extra work required.

For me the 40-uinput.rules file looks like the following

ACTION=="add|change", KERNEL=="event[0-9]*", ENV{ID_VENDOR_ID}=="012a", ENV{ID_MODEL_ID}=="034b", ENV{ID_INPUT_KEYBOARD}="1", ENV{ID_INPUT_TABLET}="1"
SUBSYSTEM=="input", ATTRS{name}=="python-uinput", ENV{ID_INPUT_KEYBOARD}="1"
KERNEL=="uinput", MODE:="0666" 

Did you set your keyboard up first with ES ? as the script reads your retroarch.cfg to get your keyboard buttons and sends keypresses using uinput. Check the readme for supported keys .

So set up your keyboard as you normally would in ES then try the script.

I'm using python-uinput version 0.10.2-1 and cec-utils version 3.0.1-3~jessie

Also you can simply run cec-utils on its own to see if your remote is being detected.

For reference I run kodi in retropie. It is installed in the ports section and works fine.

@baracudaz
Copy link
Author

Here is couple of outputs from my setup. The TV remote is detected by your script with no issues.

I cannot setup ES with regular keyboard as the only access is via SSH or TV Remote control. However what I am struggling to understand how ES detects a valid keyboard (emulated by TV remove in our case)?

Could you kindly provide output:

  • .emulationstation/es_input.cfg
  • input_player1_* setup from /opt/retropie/configs/all/retroarch.cfg

I found a couple of examples here. Now trying to figure out if I can re-use that.

For reference I run kodi in retropie. It is installed in the ports section and works fine.

See what you did there 👍

@dillbyrne
Copy link
Owner

dillbyrne commented Jan 14, 2017

I set up a keyboard first and then used that to set up a ps3 controller. once the ps3 controller was paired the keyboard was no longer needed so I plugged that out.

The "fake" keyboard is attached via a kernel module uinput and acts as a device attached at /dev/uinput , the python library interfaces with the uinput module to send key events, But a keyboard has to be configured first for ES to act on certain keypresses.

my es_input.cfg

<?xml version="1.0"?>
<inputList>
  <inputAction type="onfinish">
    <command>/opt/retropie/supplementary/emulationstation/scripts/inputconfiguration.sh</command>
  </inputAction>
  <inputConfig type="joystick" deviceName="Sony PLAYSTATION(R)3 Controller">
    <input name="pageup" type="button" id="10" value="1"/>
    <input name="start" type="button" id="3" value="1"/>
    <input name="up" type="button" id="4" value="1"/>
    <input name="a" type="button" id="13" value="1"/>
    <input name="b" type="button" id="14" value="1"/>
    <input name="down" type="button" id="6" value="1"/>
    <input name="pagedown" type="button" id="11" value="1"/>
    <input name="right" type="button" id="5" value="1"/>
    <input name="x" type="button" id="12" value="1"/>
    <input name="select" type="button" id="0" value="1"/>
    <input name="y" type="button" id="15" value="1"/>
    <input name="left" type="button" id="7" value="1"/>
  </inputConfig>
  <inputConfig type="keyboard" deviceName="Keyboard">
    <input name="pageup" type="key" id="1073742049" value="1"/>
    <input name="start" type="key" id="100" value="1"/>
    <input name="up" type="key" id="1073741906" value="1"/>
    <input name="a" type="key" id="97" value="1"/>
    <input name="b" type="key" id="98" value="1"/>
    <input name="down" type="key" id="1073741905" value="1"/>
    <input name="pagedown" type="key" id="1073742053" value="1"/>
    <input name="right" type="key" id="1073741903" value="1"/>
    <input name="x" type="key" id="120" value="1"/>
    <input name="select" type="key" id="115" value="1"/>
    <input name="y" type="key" id="121" value="1"/>
    <input name="left" type="key" id="1073741904" value="1"/>
  </inputConfig>
  <inputConfig type="joystick" deviceName="PLAYSTATION(R)3 Controller">
    <input name="pageup" type="button" id="10" value="1"/>
    <input name="start" type="button" id="3" value="1"/>
    <input name="up" type="button" id="4" value="1"/>
    <input name="a" type="button" id="13" value="1"/>
    <input name="b" type="button" id="14" value="1"/>
    <input name="down" type="button" id="6" value="1"/>
    <input name="pagedown" type="button" id="11" value="1"/>
    <input name="right" type="button" id="5" value="1"/>
    <input name="x" type="button" id="12" value="1"/>
    <input name="select" type="button" id="0" value="1"/>
    <input name="y" type="button" id="15" value="1"/>
    <input name="left" type="button" id="7" value="1"/>
  </inputConfig>
</inputList>

my retroarch.cfg player 1 keyboard input

input_player1_a = "a"
input_player1_b = "b"
input_player1_y = "y"
input_player1_x = "x"
input_player1_start = "d"
input_player1_select = "s"
input_player1_l = "shift"
input_player1_r = "rshift"
input_player1_left = "left"
input_player1_right = "right"
input_player1_up = "up"
input_player1_down = "down"
input_player1_l2 = "ctrl"
input_player1_r2 = "rctrl"
input_player1_l3 = "num1"
input_player1_r3 = "num2"

If you get it working you may need to add some code to the if statment so it does not run when osmc is running.

I'd say try copy the keyboard sections of both files and reboot and see if retropie prompts you for a keyboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants