Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/petrockblog/controlblockservice
This is the driver for the ControlBlock, a power switch and input/output/gameapd gadget for the Raspberry Pi
https://github.com/petrockblog/controlblockservice
Last synced: 22 days ago
JSON representation
This is the driver for the ControlBlock, a power switch and input/output/gameapd gadget for the Raspberry Pi
- Host: GitHub
- URL: https://github.com/petrockblog/controlblockservice
- Owner: petrockblog
- Created: 2014-11-22T16:38:05.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-05-01T14:41:18.000Z (over 6 years ago)
- Last Synced: 2023-03-25T01:43:49.855Z (over 1 year ago)
- Language: C++
- Homepage: http://blog.petrockblock.com/gadgets/controlblock-power-switch-game-controllers-and-io-for-the-raspberry-pi/
- Size: 3.11 MB
- Stars: 34
- Watchers: 5
- Forks: 6
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
ControlBlockService
===================[![Build Status](https://travis-ci.org/petrockblog/ControlBlockService.svg?branch=master)](https://travis-ci.org/petrockblog/ControlBlockService)
This is the driver for the petrockblock.com ControlBlock, which is an extension board for the Raspberry Pi (TM). The driver itself is denoted as _controlblock_ in the following. The driver provides a service for interacting with the power button signals as well as for mapping attached game controllers to corresponding game pad devices on the Raspberry Pi.
**Please note that this is the driver for revision 1.X of the ControlBlock. If you have a revision 2.X board, you need to use the [driver for that revision series](https://github.com/petrockblog/ControlBlockService2).**
## Prerequisites
To be able to successfully build ControlBlockService you need to have certain APT packages installed. You can make sure that you have the latest version of those packages with these commands:
```bash
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y git cmake g++-4.9 doxygen
```## Downloading
If you would like to download the latest version of _controlblock_ from [its Github repository](https://github.com/petrockblog/ControlBlockService), you can use this command:
```bash
git clone --recursive https://github.com/petrockblog/ControlBlockService.git
```Note that the above command also takes care for downloading the included Git submodules.
## Quick Installation
There comes an installation script with this reposity that does all the steps described below: `install.sh` This script compiles the driver, installs the binary and configuration files, and installs the ControlBlock service.
To run the quick installation, you just need to call this one line from the Raspbian console
```bash
wget -O - https://raw.githubusercontent.com/petrockblog/ControlBlockService/master/install.sh | sudo bash
```## Building and Installation
To build _controlblock_ follow these commands:
```bash
cd ControlBlockService
mkdir build
cd build
cmake ..
make
```If everything went fine you can install the driver from within the folder `build` with the command
```bash
sudo make install
```## Installation as Service
You can install _controlblock_ as daemon from within the folder `build` with this command:
```bash
sudo make installservice
```
It might be that you need to **restart** your Raspberry afterwards to have all needed services running.## Uninstalling the service and/or the binary
You can uninstall the daemon from within the folder `build` with this command:
```bash
sudo make uninstallservice
```You can uninstall the binary with this command:
```bash
sudo make uninstall
```## Configuration
The configuration file of _controlblock_ is located at ```/etc/controlblockconfig.cfg```. It uses JSON syntax for setting the the values of its configuration parameters.
The parameters are explained in detail in the following:
- ```input - gamepadtype```: Can be set to
+ ```arcade```: Enables two game pads in the system and maps the GPIOs of the ControlBlock to these game pads.
![ArcadeMapping](https://github.com/petrockblog/ControlBlockService/raw/master/supplementary/ControlBlockLayoutArcade.png)
+ ```mame```: Enables a virtual keyboard and maps the GPIOs of the ControlBlock to this keyboard with a MAME layout.
![ArcadeMapping](https://github.com/petrockblog/ControlBlockService/raw/master/supplementary/ControlBlockLayoutMAME.png)
+ ```snes```: Enables two game pads in the system and maps the attached SNES/NES controllers accordingly.
![ArcadeMapping](https://github.com/petrockblog/ControlBlockService/raw/master/supplementary/ControlBlockLayoutSNESNES.png)
- ```input - singlegamepad```: Can be set to
+ ```true```: Enables only one gamepad in the system (eg if only Player1 buttons are wired to the controlblock in your setup, this prevents a ghost gamepad from being selected as default player 2 in retroarch)
+ ```false```: Enables the two gamepads (default)
- ```powerswitch - activated```: Can be set to
+ ```true```: Activates the handling of the power switch signals of the ControlBlock.
+ ```false```: Deactivates the handling of the power switch signals of the ControlBlock.
__Have fun!__-Florian [petrockblock.com](http://blog.petrockblock.com)