Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
remotebuzzer: own config to enable HID device and software button sup…
Browse files Browse the repository at this point in the history
…port

- there might be differen use cases, this way we can catch them all

Change-Id: Ic22d34e5ef25aab4c35ec5345993b2875c9baa06
  • Loading branch information
andi34 committed Sep 25, 2021
1 parent 928d90f commit dff4280
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 20 deletions.
2 changes: 2 additions & 0 deletions config/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@
$config['remotebuzzer']['userotary'] = false;
$config['remotebuzzer']['enable_standalonegallery'] = false;
$config['remotebuzzer']['usegpio'] = true;
$config['remotebuzzer']['usehid'] = false;
$config['remotebuzzer']['usesoftbtn'] = false;
$config['remotebuzzer']['rotaryclkgpio'] = 27;
$config['remotebuzzer']['rotarydtgpio'] = 17;
$config['remotebuzzer']['rotarybtngpio'] = 22;
Expand Down
53 changes: 38 additions & 15 deletions faq/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,27 @@ For example use <a href="https://keycode.info" target="_blank">https://keycode.i
**PRINT section**:
- Key code which triggers printing: **define**

#### Remotebuzzer Software Button feature (Linux only)
Software buttons can use the Remotebuzzer feature to make the button action taking effect at the same time on all devices accessing Photobooth!

- Related configuration:
**GENERAL section**:
- IP address of the Photobooth web server: **define**

**HARDWARE BUTTON section**:
- Enable Software Buttons: **on**
- __Optional:__ Use GPIO for remotebuzzer: **off**

Special Notes:

- **Important: For WLAN connected screens you must make sure to set the IP address of the Photobooth web server in the admin settings - section "General"**. The loopback IP (127.0.0.1) does not work, it has to be the exact IP address of the Photobooth web server, to which the remote display connects to.
- Can be combined with HID-Device buttons, GPIO connected Hardware Button and Rotary Encoder!
- Having trouble?
- Switch Photobooth to DEV mode. (admin screen -> expert view -> general section)
- Reload the Photobooth homepage
- Check the browser developer console for error logs
- Check the server logs for errors at the Debug panel: [http://localhost/admin/debugpanel.php](http://localhost/admin/debugpanel.php)

#### Remotebuzzer Hardware Button feature using connected HID devices (Linux only)
An HID device connected to your hardware can trigger different actions. The HID device must be connected to one device you're accessing Photobooth from.
Using the Remotebuzzer feature makes the button action taking effect at the same time on all devices accessing Photobooth!
Expand All @@ -146,17 +167,18 @@ For example use <a href="https://keycode.info" target="_blank">https://keycode.i
- Key code which triggers a collage: **define**

**HARDWARE BUTTON section**:
- Enable Hardware Buttons: **on**
- Use GPIO for remotebuzzer: **off**
- Enable HID-Device Buttons: **on**
- __Optional:__ Use GPIO for remotebuzzer: **off**

Special Notes:

- **Important: For WLAN connected screens you must make sure to set the IP address of the Photobooth web server in the admin settings - section "General"**. The loopback IP (127.0.0.1) does not work, it has to be the exact IP address of the Photobooth web server, to which the remote display connects to.
- Switch Photobooth to DEV mode. (admin screen -> expert view -> general section)
- Reload the Photobooth homepage
- Check the browser developer console for error logs
- Check the server logs for errors (file `data/tmp/remotebuzzer_server.log`)
- GPIO connected Hardware Button and Rotary Encoder don't work!
- Can be combined with GPIO connected Hardware Button and Rotary Encoder!
- Having trouble?
- Switch Photobooth to DEV mode. (admin screen -> expert view -> general section)
- Reload the Photobooth homepage
- Check the browser developer console for error logs
- Check the server logs for errors at the Debug panel: [http://localhost/admin/debugpanel.php](http://localhost/admin/debugpanel.php)

#### Remotebuzzer Hardware Button feature using GPIO connected hardware (Raspberry Pi only)
The **Hardware Button** feature enables to control Photobooth through hardware buttons connected to Raspberry GPIO pins. This works for directly connected screens and as well for WLAN connected screen (i.e. iPad). Configuration takes place in the admin settings - Hardware Button section.
Expand All @@ -174,19 +196,20 @@ Photobooth will watch GPIOs for a PIN_DOWN event - so the hardware button needs
Troubleshooting / Debugging:

- **Important: For WLAN connected screens you must make sure to set the IP address of the Photobooth web server in the admin settings - section "General"**. The loopback IP (127.0.0.1) does not work, it has to be the exact IP address of the Photobooth web server, to which the remote display connects to.
- Switch Photobooth to DEV mode. (admin screen -> expert view -> general section)
- Reload the Photobooth homepage
- Check the browser developer console for error logs
- Check the server logs for errors (file `data/tmp/remotebuzzer_server.log`).
- If there is no errors logged but hardware buttons still do not trigger
- GPIO interrupts might be disabled. Check file `/boot/config.txt` and remove / disable the following overlay `dtoverlay=gpio-no-irq` to enable interrupts for GPIOs.
- GPIOs may not be configured as PULLUP. The configuration for this is done in fie `/boot/config.txt` by adding the GPIO numbers in use as follows - you **must reboot** the Raspberry Pi in order to activate changes in this setting.
- Having trouble?
- Switch Photobooth to DEV mode. (admin screen -> expert view -> general section)
- Reload the Photobooth homepage
- Check the browser developer console for error logs
- Check the server logs for errors (file `data/tmp/remotebuzzer_server.log`)
- If there is no errors logged but hardware buttons still do not trigger:
- GPIO interrupts might be disabled. Check file `/boot/config.txt` and remove / disable the following overlay `dtoverlay=gpio-no-irq` to enable interrupts for GPIOs.
- GPIOs may not be configured as PULLUP. The configuration for this is done in fie `/boot/config.txt` by adding the GPIO numbers in use as follows - you **must reboot** the Raspberry Pi in order to activate changes in this setting.

```
gpio=16,17,20,21,22,26,27=pu
```

- For the Shutdown button to work, `www-data` needs to have the necessary sudo permissions. This is done by the `install-raspian.sh` script or can be manually added as
- For the Shutdown button to work, `www-data` needs to have the necessary sudo permissions. This is done by the `install-raspian.sh` script or can be manually added as

```
cat >> /etc/sudoers.d/020_www-data-shutdown << EOF
Expand Down
12 changes: 12 additions & 0 deletions lib/configsetup.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,18 @@
'name' => 'remotebuzzer[userotary]',
'value' => $config['remotebuzzer']['userotary'],
],
'remotebuzzer_usehid' => [
'view' => 'advanced',
'type' => 'checkbox',
'name' => 'remotebuzzer[usehid]',
'value' => $config['remotebuzzer']['usehid'],
],
'remotebuzzer_usesoftbtn' => [
'view' => 'advanced',
'type' => 'checkbox',
'name' => 'remotebuzzer[usesoftbtn]',
'value' => $config['remotebuzzer']['usesoftbtn'],
],
'remotebuzzer_usegpio' => [
'view' => 'advanced',
'type' => 'checkbox',
Expand Down
4 changes: 4 additions & 0 deletions resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,9 @@
"manual:remotebuzzer:remotebuzzer_shutdownholdtime": "Seconds to hold button until system shutdown will be initiated. Setting to Zero (0) means immediate shutdown without waiting time.",
"manual:remotebuzzer:remotebuzzer_usebuttons": "This feature enables hardware button support - see FAQ for details. Please activate GPIO support for remotebuzzer. IMPORTANT: For WLAN connected screens you must make sure to configure the IP address of the Photobooth web server in the section \"General\", for this feature to work properly.",
"manual:remotebuzzer:remotebuzzer_usegpio": "This feature enables hardware support through Raspberry GPIO pins - see FAQ for details. IMPORTANT: For WLAN connected screens you must make sure to configure the IP address of the Photobooth web server in the section \"General\", for this feature to work properly.",
"manual:remotebuzzer:remotebuzzer_usehid": "This feature enables HID Device support - see FAQ for details. Inside the picture section \"Key code which triggers a photo\" and inside collage section \"Key code which triggers a collage\" must be defined! IMPORTANT: For WLAN connected screens you must make sure to configure the IP address of the Photobooth web server in the section \"General\", for this feature to work properly.",
"manual:remotebuzzer:remotebuzzer_userotary": "Enable Rotary Encoder support for to navigate the screen. Needs a rotary encoder switch connected to the GPIOs - see FAQ for details. Please activate GPIO support for remotebuzzer. IMPORTANT: For WLAN connected screens you must make sure to configure the IP address of the Photobooth web server in the section \"General\", for this feature to work properly.",
"manual:remotebuzzer:remotebuzzer_usesoftbtn": "This feature enables Software Button support - see FAQ for details. IMPORTANT: For WLAN connected screens you must make sure to configure the IP address of the Photobooth web server in the section \"General\", for this feature to work properly.",
"manual:reset:reset_button": "Will execute config reset. If you like to also reset images and / or the mail address database make sure you first activate those settings and save (!) the config, then perform the config reset itself.",
"manual:reset:reset_remove_config": "If enabled, personal config gets removed on reset.",
"manual:reset:reset_remove_images": "If enabled, all images gets removed on reset.",
Expand Down Expand Up @@ -537,7 +539,9 @@
"remotebuzzer:remotebuzzer_shutdownholdtime": "Seconds to initiate shutdown",
"remotebuzzer:remotebuzzer_usebuttons": "Enable Hardware Buttons",
"remotebuzzer:remotebuzzer_usegpio": "Use GPIO for remotebuzzer",
"remotebuzzer:remotebuzzer_usehid": "Enable HID-Device Buttons",
"remotebuzzer:remotebuzzer_userotary": "Enable Rotary Encoder",
"remotebuzzer:remotebuzzer_usesoftbtn": "Enable Software Buttons",
"reset": "Reset",
"reset:reset_button": "Execute config reset",
"reset:reset_remove_config": "Delete personal configuration (my.config.inc.php)",
Expand Down
8 changes: 4 additions & 4 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ const photoBooth = (function () {
// Take Picture Button
$('.takePic, .newpic').on('click', function (e) {
e.preventDefault();
if (config.remotebuzzer.usebuttons || config.remotebuzzer.userotary) {
if (config.remotebuzzer.usesoftbtn) {
remoteBuzzerClient.startPicture();
} else {
api.thrill('photo');
Expand All @@ -1071,7 +1071,7 @@ const photoBooth = (function () {
$('.takeCollage, .newcollage').on('click', function (e) {
e.preventDefault();

if (config.remotebuzzer.usebuttons || config.remotebuzzer.userotary) {
if (config.remotebuzzer.usesoftbtn) {
remoteBuzzerClient.startCollage();
} else {
api.thrill('collage');
Expand Down Expand Up @@ -1211,7 +1211,7 @@ const photoBooth = (function () {
$('.triggerPic').on('click', function (e) {
e.preventDefault();

if (config.remotebuzzer.usebuttons || config.remotebuzzer.userotary) {
if (config.remotebuzzer.usehid) {
remoteBuzzerClient.startPicture();
} else {
api.thrill('photo');
Expand All @@ -1223,7 +1223,7 @@ const photoBooth = (function () {
$('.triggerCollage').on('click', function (e) {
e.preventDefault();

if (config.remotebuzzer.usebuttons || config.remotebuzzer.userotary) {
if (config.remotebuzzer.usehid) {
remoteBuzzerClient.startCollage();
} else {
api.thrill('collage');
Expand Down
7 changes: 6 additions & 1 deletion src/js/remotebuzzer_client.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ function initRemoteBuzzerFromDOM() {
const api = {};

api.enabled = function () {
return config.remotebuzzer.usebuttons || config.remotebuzzer.userotary;
return (
config.remotebuzzer.usebuttons ||
config.remotebuzzer.userotary ||
config.remotebuzzer.usehid ||
config.remotebuzzer.usesoftbtn
);
};

api.init = function () {
Expand Down

0 comments on commit dff4280

Please sign in to comment.