kenzo
Posts: 4
Joined: Sun Mar 09, 2014 4:17 pm

Re: Universal GPIO keyboard daemon

Sun Mar 09, 2014 4:25 pm

Hi mmoller,
I visited your website and I saw the schematic ( https://github.com/mmoller2k/pikeyd/blo ... wiring.png ).

According to this schematic you are ORing the interrupts coming from MCP23017 and putting the signals directly into Raspy using a power source of 5V.

This interrupt signal could be harmful to the Raspy that supports 3.3V maximum for GPIO?

thanks

lxx33
Posts: 5
Joined: Tue Aug 19, 2014 4:08 pm

Re: Universal GPIO keyboard daemon

Tue Aug 19, 2014 4:28 pm

I also strugle, but that was expected as i'm a complete newby.
I download different Arcade versions like retropie and Piplay, but can't get te arcade controls working.
Also followed adafruit tutorial, but somehow did not have all or the same files.

Now i've downloaded piplay-0.8-beta5.img and also have a working mame rom game. I can play with keyboard but not with original arcade controls. I have set up the GPIO through resistors (10k and 1k) and also with 3.3v and ground.
I followed instructions like. http://www.newsdownload.co.uk/pages/RPi ... stick.html.
Now my GPIO 17, 23, 10,9, 25 and 7 is used. And the 3.3v and the GND.

Here I downloaded pikeyd and also placed it in /usr/local/bin/
In terminal I did sudo make, but after that still no working GPIO.
I also tried and modified rc.local.
/usr/local/bin/pikeyed -d
_IP=$ ect.
ect.ect
exit 0

I reboot the raspberry, but still no luck :(

Hope somebody have tips.

I also tried it without pullup resisorts just like adafruits tutorial.

User avatar
DigitalLumberjack
Posts: 336
Joined: Thu May 22, 2014 8:55 am
Location: France
Contact: Website

Re: Universal GPIO keyboard daemon

Wed Aug 20, 2014 5:43 am

Hi, I have had many issue too with gpio to keyboard tools so i used a gpio to joystick driver that works with all emulators like a charme. It could be a solution if you dont really need keyboard strokes. See https://github.com/digitalLumberjack/mk ... ystick_rpi and give it a try.

PhillyNJ
Posts: 112
Joined: Sat Dec 29, 2012 4:07 am

Re: Universal GPIO keyboard daemon

Thu Aug 21, 2014 12:24 pm

I have put together a complete tutorial which uses pikeyd.

http://phillystutorials.blogspot.com/20 ... rcade.html

Walks you through creating the arcade with advmame and pikeyd and includes instructions on how to wire up your GPIO.

User avatar
UsagiYojimbo
Posts: 1
Joined: Mon Aug 25, 2014 4:30 am
Location: Debrecen, Hungary
Contact: ICQ

Re: Universal GPIO keyboard daemon

Mon Aug 25, 2014 4:56 am

DavidL wrote:I have just pushed some alpha pikeyd code back into GitHub under a "key_matrix" branch: https://github.com/Lencons/pikeyd
What I have tested as working with this is:
...
2) Switches can now be connected in a matrix format and basic testing shows this as working.
...
What isn't working is:
1) I have no idea if I/O Extenders are working and I would assume not as all my messing around with the code has bound to have broken them. But happy for someone to test it and prove me wrong or help fix it.
Hi,
I have a project placing my Pi inside an old CD-player, to make an HTPC. I want to connect the CD-player's buttons and other controls to the Pi, so I was looking a way to do this. That's how i got here...
I made a schematic of all the components, and as the CD-player's buttons are in a matrix, i wanted to retain them in this way. Also to make the CD-player's LCD, IR sensor, and the RaspiLight work, I needed more GPIO pins, so i decided to use an I/O extender.
My question is, that is it possible to combine both your versions, so that the matrix capability will work on extenders?

Here's my "design", the keys are a 5×3 matrix:
(It does not show the INT signals connected, nor the RaspiLight.)
Image
"I like my sugar with coffee and cream" (Beasty Boys - Intergalactic)

powenko
Posts: 4
Joined: Thu Apr 03, 2014 11:52 pm

Re: Universal GPIO keyboard daemon

Wed Aug 27, 2014 11:58 pm

Thank you mmoller2k, it is working great on my project.
Image

MisterM
Posts: 2
Joined: Tue Nov 11, 2014 5:36 pm

Re: Universal GPIO keyboard daemon

Tue Nov 11, 2014 6:02 pm

Hi - I've been scratching my head with this for a little while and have had a good look around the threads but wondered if I'm missing something obvious! I've followed the great step-bystep tutorial that PhillyNJ posted, but using the GitHub link to DavidL's code. My reason for using DavidL's version is that I'm not using an I/O Expander and just want to use the GPIO connections for Raspbmc control buttons - also it seems to suggest that the internal pull-ups are used in this branch, so a button can be wired directly between GPIO pin and GND. Anyway it all installed fine, and my files are below:

Code: Select all

[email protected]:~$ sudo nano /etc/pikeyd.conf
  GNU nano 2.2.6            File: /etc/pikeyd.conf

#joy.cfg

#format:
# [keycode from /usr/include/linux/input.h] [whitespace] [GPIO pin no]
# Not limited to a single key. A GPIO press will emit all defined keys in order.

KEY_PLAYPAUSE   2
KEY_PLAYPAUSE   3
KEY_REWIND      4
KEY_FASTFORWARD 17
KEY_STOP        27
KEY_F20         22
KEY_F21         10
KEY_ESC         9
KEY_UP          11
KEY_ENTER       18
KEY_LEFT        23
KEY_DOWN        24
KEY_RIGHT       25

#define I/O expanders before using them
#XIO(tag) gpio_int_pin/chip_addr:register_no
#MCP23008 only has a single 8-bit bank
#XIO_M          17/0x20/MCP23008
#define an MCP23008 expander at address 0x20 with interrupt wired to GPIO-17

#MCP23017 has two 8-bit banks
#XIO_A          17/0x20/MCP23017A
#XIO_B          17/0x20/MCP23017B

#KEY_O          XIO_M:1
#KEY_L          XIO_M:2
#KEY_E          XIO_A:6
#KEY_E          XIO_B:6

Code: Select all

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
[email protected]:~$ sudo pikeyd
Config file is /etc/pikeyd.conf
Polling 13 GPIO pin(s).
Found 0 I/O expander(s).
Ready.
Joystick init OK.
Press ^C to exit.

Code: Select all

[email protected]:~$ sudo nano /etc/rc.local
  GNU nano 2.2.6             File: /etc/rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
/usr/local/bin/pikeyd -d
exit 0

It seems to be very close to working in that there are no error messages and pikeyd is reporting the right amount of pins being polled, I just get no response when pressing the physical buttons. I'm checking by logging in via Putty, doing sudo pikeyd then pressing the buttons for a response. The only thing plugged into the pi's USB is a Microsoft IR receiver (hmm might unplug it but I do need both buttons and IR to work simultaneously).

My current feelings are that the problem possibly lies with:

- My board being a B+ and this needing something different/extra in the code
- The internal pullups need to be configured somewhere and I've missed it
- Something else simple that I've overlooked!

The physical buttons are connected to a paddle breakout board and I've double-checked the connections are sound and the pins are correct. I've read posts about the blacklist file but it isn't there.

Any help gratefully received.

MisterM
Posts: 2
Joined: Tue Nov 11, 2014 5:36 pm

Re: Universal GPIO keyboard daemon

Fri Nov 14, 2014 7:59 pm

Oops just realised I didn't install the key_matrix branch which has the internal pullups bit in. Downloaded it and tried to make it but got the following:

Code: Select all

[email protected]:~$ make -C pikeyd
make: Entering directory `/home/pi/pikeyd'
arm-linux-gnueabihf-gcc -O2 -Wstrict-prototypes -Wmissing-prototypes 

-I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/include 

-I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/libc/usr/incl

ude 

-I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/gcc/arm-linux-gnueabihf/4.7.2

/include-fixed 

-I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/gcc/arm-linux-gnueabihf/4.7.2

/include 

-I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/gcc/arm-linux-gnueabihf/4.7.2

/finclude -c config.c -o config.o
config.c:37:18: fatal error: gpio.h: No such file or directory
compilation terminated.
make: *** [config.o] Error 1
make: Leaving directory `/home/pi/pikeyd'
[email protected]:~$


Any ideas on the gpio.h error? Thanks!

NedScott
Posts: 13
Joined: Sun Aug 24, 2014 3:02 am

Re: Universal GPIO keyboard daemon

Wed Jul 08, 2015 7:01 pm

MisterM wrote:Any ideas on the gpio.h error? Thanks!
I get the same error. I'm not a programmer so I might be wrong, but I think this entire file is missing from DavidL's github repo. Maybe he forgot to upload it?

DavidL
Posts: 13
Joined: Sat Aug 17, 2013 7:17 am

Re: Universal GPIO keyboard daemon

Thu Jul 09, 2015 10:34 am

Guys,

Let me fix that for you. Correct I will assume that the header file was not pushed back up into the repo.

There was also a bug I found in the code that I fixed since it was last pushed up.

If everyone can hold tight for a couple of days I will sort it out and provide an update.

- Dave.

NedScott
Posts: 13
Joined: Sun Aug 24, 2014 3:02 am

Re: Universal GPIO keyboard daemon

Thu Jul 09, 2015 10:36 am

Thank you so much for looking into this. Take all the time you need :D

DavidL
Posts: 13
Joined: Sat Aug 17, 2013 7:17 am

Re: Universal GPIO keyboard daemon

Thu Jul 16, 2015 6:44 am

I have pushed all of the current code base into the master branch.

I haven't trying running it as yet but it does compile. It seems I was part way fixing how the daemonize code worked so potentially as long as you run it from the command line it should be good.

I will set the test bench up again in the next couple of days, but let me know if you find any issues and I will sort them out.

- Dave.

NedScott
Posts: 13
Joined: Sun Aug 24, 2014 3:02 am

Re: Universal GPIO keyboard daemon

Mon Jul 27, 2015 1:41 am

Now I get this:

Code: Select all

[email protected] ~/pikeyd $ make
arm-linux-gnueabihf-gcc -O2 -Wstrict-prototypes -Wmissing-prototypes -I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/include -I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/arm-linux-gnueabihf/libc/usr/include -I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/gcc/arm-linux-gnueabihf/4.7.2/include-fixed -I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/gcc/arm-linux-gnueabihf/4.7.2/include -I/home/pi/RPi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/lib/gcc/arm-linux-gnueabihf/4.7.2/finclude -c config.c -o config.o
config.c:60:1: error: expected identifier or ‘(’ before ‘<<’ token
config.c:70:1: error: expected identifier or ‘(’ before ‘==’ token
config.c:85:1: error: expected identifier or ‘(’ before ‘>>’ token
config.c:97:1: error: expected identifier or ‘(’ before ‘<<’ token
config.c:106:1: error: expected identifier or ‘(’ before ‘<<’ token
Makefile:23: recipe for target 'config.o' failed
make: *** [config.o] Error 1
Any ideas?

NedScott
Posts: 13
Joined: Sun Aug 24, 2014 3:02 am

Re: Universal GPIO keyboard daemon

Mon Jul 27, 2015 1:52 am

Never mind. Seems to just be some errant text on your master branch. The key_matrix branch compiles fine.

NedScott
Posts: 13
Joined: Sun Aug 24, 2014 3:02 am

Re: Universal GPIO keyboard daemon

Mon Jul 27, 2015 5:21 am

I got everything compiled and tried to configure it for direct GPIO + ground controls, but I'm thinking I might be misunderstanding the conflig file instructions. I get this error
[email protected] ~ $ sudo /usr/local/bin/pikeyd
Config file is /etc/pikeyd.conf
ERROR: /etc/pikeyd.conf line 1: GPIO04 pull resister not set, pin no set for input.
This is my pikeyd.conf:

Code: Select all

PULL_UP GPIO04
PULL_UP GPIO14
PULL_UP GPIO15
PULL_UP GPIO17
PULL_UP GPIO18
PULL_UP GPIO27
PULL_UP GPIO22
PULL_UP GPIO23
PULL_UP GPIO24
PULL_UP GPIO10
PULL_UP GPIO09
PULL_UP GPIO25

KEY_UP  04
KEY_DOWN        17
KEY_LEFT        27
KEY_RIGHT       22
KEY_ENTER       25
KEY_ESC 24
KEY_C   10
KEY_X   09
KEY_1   14
KEY_2   23
KEY_3   15
KEY_4   18

NedScott
Posts: 13
Joined: Sun Aug 24, 2014 3:02 am

Re: Universal GPIO keyboard daemon

Mon Jul 27, 2015 6:30 am

Looks like I just needed to define the keys first and then the PULL_UP after that. It's all working now! Thank you both DavidL and mmoller2k!

daxdax
Posts: 1
Joined: Tue Sep 01, 2015 11:04 pm

Re: Universal GPIO keyboard daemon

Tue Sep 01, 2015 11:06 pm

I get an error saying module uinput is not found.
When I try running the command 'sudo modprobe uinput' I get an error: FATAL: Module uinput not found.

Any ideas? :shock:

DavidL
Posts: 13
Joined: Sat Aug 17, 2013 7:17 am

Re: Universal GPIO keyboard daemon

Thu Sep 03, 2015 10:04 am

daxdax wrote:I get an error saying module uinput is not found.
When I try running the command 'sudo modprobe uinput' I get an error: FATAL: Module uinput not found.

Any ideas? :shock:
uinput is not a kernal module, it is part of the source code. This error is suggesting that you are missing either (or both) of uinput.c or uinput.h during the build process.

Check that you have the most recent (and complete) version of the master branch and it should compile cleanly.

If you are still getting errors, please post the the exact output you are getting and we can go from there.

- Dave.

User avatar
rpdom
Posts: 13564
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Universal GPIO keyboard daemon

Thu Sep 03, 2015 10:17 am

daxdax wrote:I get an error saying module uinput is not found.
When I try running the command 'sudo modprobe uinput' I get an error: FATAL: Module uinput not found.
Are you running a kernel other than the standard Raspbian one?

The uinput driver should be available as a module. It exists on all my Pis

Code: Select all

[email protected]:~# modinfo uinput
filename:       /lib/modules/4.1.6+/kernel/drivers/input/misc/uinput.ko
version:        0.3
license:        GPL
description:    User level driver support for input subsystem
author:         Aristeu Sergio Rozanski Filho
alias:          devname:uinput
alias:          char-major-10-223
srcversion:     033449FF7BD543FA6598FB0
depends:        
intree:         Y
vermagic:       4.1.6+ preempt mod_unload modversions ARMv6 
DavidL wrote:uinput is not a kernal module
Yes it is :)
The code in uinput.h interfaces with the module.

DavidL
Posts: 13
Joined: Sat Aug 17, 2013 7:17 am

Re: Universal GPIO keyboard daemon

Mon Sep 07, 2015 6:23 am

DavidL wrote:uinput is not a kernal module
Yes it is :)
The code in uinput.h interfaces with the module.
Well yeah true. I just assumed that it may have been in reference to an issue with the previous commit of code which didn't include the uinput.c/.h files.

But OP does reference "module" in their request so possibly this is a kernel issue.

- Dave.

Michielo
Posts: 19
Joined: Fri Sep 13, 2013 7:20 pm

Re: Universal GPIO keyboard daemon

Fri Oct 16, 2015 11:13 am

Hi all,

I had a quick (and hopefully) easy question regarding pikeyd.

I am looking into building a squeezelite player with jivelite showing the squeezebox UI on a 3.5 inch touchscreen. I can control squeezelite through the touchscreen but also was thinking of adding buttons to create shortcuts (e.g. directly go to artists, radio, spotify, etc.).

To be able to do that, I would need to have one button simulate multiple key strokes as in [home] + 3 * [arrow down] + 2 * [arrow right] + [enter].

Is it possible to configure pikeyd to accept a series of key strokes with one button press?

Thanks for your response.

Michielo

DavidL
Posts: 13
Joined: Sat Aug 17, 2013 7:17 am

Re: Universal GPIO keyboard daemon

Mon Oct 19, 2015 12:36 am

Michielo wrote:I would need to have one button simulate multiple key strokes as in [home] + 3 * [arrow down] + 2 * [arrow right] + [enter].

Is it possible to configure pikeyd to accept a series of key strokes with one button press?
The current configuration functionality will not support assigning a string as output, but it won't be a significant change to the code to allow it.

- Dave.

Michielo
Posts: 19
Joined: Fri Sep 13, 2013 7:20 pm

Re: Universal GPIO keyboard daemon

Fri Oct 30, 2015 11:13 pm

Hi David,

Thanks for your response. Considering scripting is all very new to me, I'll probably need some help on this.

When I look at the files on GitHub, I see 2 files that have key definitions being Keydefs.c and pikeyd.conf.

I assume I need to configure the last one. I am going to use an MCP230017, so I will first need to define (assuming pin 17 is used - btw which numbering convention is this using? Board, chip, other?)

XIO_A 17/0x20/MCP23017A
XIO_B 17/0x20/MCP23017B

To assign entries to a key I probably want to look at the last section in pikeyd.conf,
KEY_E XIO_A:6
KEY_E XIO_B:6

If that is correct, how do I then define the string if for example I want to assign [KEY_LEFT+KEY_LEFT+KEY_UP+KEY_ENTER] to XIO_A:1?

Any leads on where I should start to reconfigure things would be highly appreciated.

Thanks

phanegem
Posts: 2
Joined: Fri Nov 06, 2015 12:58 pm

Re: Universal GPIO keyboard daemon

Fri Nov 06, 2015 1:15 pm

Conner Labs wrote:
pitunes1.jpg
9 buttons and a rotary encoder all working nicely 8-)
The rotary encoder is a Grayhill 62A22. I modified the code a bit to handle it.
Can you tell me how you modified the code for the rotary encoder, i want to use two of them in my project

thks

Return to “Gaming”