[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-tohkbd2.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-tohkbd2.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -6,7 +6,7 @@
<service name="tar_git">
<param name="url">https://github.com/kimmoli/tohkbd2.git</param>
<param name="branch">master</param>
- <param name="revision">d547b803f40db46c2684ad7d043447d10e6352e2</param>
+ <param name="revision">1746441f948faa1f087ee7902363c0acccd8bf4c</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-tohkbd2-0.1.8.1.tar.bz2/daemon/src/tca8424driver.h
^
|
@@ -11,7 +11,7 @@
#define LED_SYMLOCK_OFF 0x0400
#define LED_BACKLIGHT_ON 0x0808
#define LED_BACKLIGHT_OFF 0x0800
-
+#define LED_ALL_OFF 0x0F00
class tca8424driver : public DriverBase
{
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-tohkbd2-0.1.8.1.tar.bz2/daemon/src/tohkeyboard.cpp
^
|
@@ -262,6 +262,7 @@
printf("Display status changed to \"%s\"\n", turn);
if (strcmp(turn, "on") == 0)
{
+ controlLeds(true);
checkDoWeNeedBacklight();
displayIsOn = true;
slideEventEmitted = false;
@@ -270,11 +271,8 @@
{
displayIsOn = false;
- if (backlightTimer->isActive() || forceBacklightOn)
- {
- backlightTimer->stop();
- tca8424->setLeds(LED_BACKLIGHT_OFF);
- }
+ backlightTimer->stop();
+ controlLeds(false);
}
}
@@ -317,20 +315,14 @@
if (!keypadIsPresent)
{
keyboardConnectedNotification(true);
- tca8424->setLeds((keymap->symPressed ? LED_SYMLOCK_ON : LED_SYMLOCK_OFF)
- | ((keymap->ctrlPressed || keymap->altPressed) ? LED_EXTRA_ON : LED_EXTRA_OFF)
- | ((capsLockSeq == 3) ? LED_CAPSLOCK_ON : LED_CAPSLOCK_OFF));
+ controlLeds(true);
checkDoWeNeedBacklight();
checkEEPROM();
}
- else if (res == tca8424driver::NoKeyPressedSinceReset)
+ else if (res == tca8424driver::NoKeyPressedSinceReset && displayIsOn)
{
/* Keyboard power interrupt shortly? refresh leds just in case */
- tca8424->setLeds((keymap->symPressed ? LED_SYMLOCK_ON : LED_SYMLOCK_OFF)
- | ((keymap->ctrlPressed || keymap->altPressed) ? LED_EXTRA_ON : LED_EXTRA_OFF)
- | ((capsLockSeq == 3) ? LED_CAPSLOCK_ON : LED_CAPSLOCK_OFF));
- if (forceBacklightOn)
- tca8424->setLeds(LED_BACKLIGHT_ON);
+ controlLeds(true);
}
presenceTimer->start();
@@ -351,6 +343,27 @@
return keypadIsPresent;
}
+/* Controls backlight and status leds
+ * restore = true - restores previous state according to internal states
+ * restore = false - turns leds off
+ */
+void Tohkbd::controlLeds(bool restore)
+{
+ if (restore)
+ {
+ tca8424->setLeds((keymap->symPressed ? LED_SYMLOCK_ON : LED_SYMLOCK_OFF)
+ | ((keymap->ctrlPressed || keymap->altPressed) ? LED_EXTRA_ON : LED_EXTRA_OFF)
+ | ((capsLockSeq == 3) ? LED_CAPSLOCK_ON : LED_CAPSLOCK_OFF));
+
+ if (forceBacklightOn)
+ tca8424->setLeds(LED_BACKLIGHT_ON);
+ }
+ else
+ {
+ tca8424->setLeds(LED_ALL_OFF);
+ }
+}
+
/* GPIO interrupt handler.
* Called when TOHKBD keyboard part is attached to the base, and
* when there is new input report due a key press.
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-tohkbd2-0.1.8.1.tar.bz2/daemon/src/tohkeyboard.h
^
|
@@ -91,6 +91,7 @@
bool tohcoreBind(bool bind);
void notificationSend(QString summary, QString body);
void screenShot();
+ void controlLeds(bool restore);
int gpio_fd;
|