[-]
[+]
|
Changed |
_service:tar_git:triambienced.spec
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,7 +2,7 @@
<service name="tar_git">
<param name="url">https://github.com/sailfishos-oneplus5/triambience-daemon.git</param>
<param name="branch">master</param>
- <param name="revision">bf3988756cc4db994b6fd2be50206ad8e30648c5</param>
+ <param name="revision">aa91ae683973af5d80469d377cbd663a2ae4059c</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Changed |
_service:tar_git:triambienced-1.2.0.tar.bz2/README.md
^
|
@@ -13,10 +13,32 @@
There is also a [Sailfish OS settings plugin](https://github.com/sailfishos-oneplus5/onyx-triambience-settings-plugin) available for simple control of these values through the settings app.
## Adaptation
-Now you can add a `/etc/dconf/db/vendor.d/triambienced.txt` file in your droid-config sparse files to choose the correct tristate key node when needed without having to fork this project, for example:
+You can now add a `/etc/dconf/db/vendor.d/triambience-daemon.txt` file in your droid-config sparse files to choose the correct tristate key node and emitted key event codes if needed without having to fork this project, for example:
```
[apps/onyxtristate]
sliderDevice='/dev/input/event6'
+sliderCodes=[0x25b, 0x25a, 0x259]
```
-The [emitted tristate key event codes](https://github.com/sailfishos-oneplus5/triambience-daemon/commit/15772a57e8571799939bc1b7a80f7d04beb4771e#diff-855c3a38d4fc3858a48957f816ac34dfL115) still have to be changed in source for now; expect this to get easier soon ;)
+To find the device event node you can install the `mce-tools` package and run `evdev_trace`; it should be pretty obvious looking at the names which one is your device's tri-state key / notification slider:
+```
+[nemo@OnePlus5 ~]$ evdev_trace
+...
+----====( /dev/input/event3 )====----
+Name: "tri-state-key"
+ID: bus 0x0, vendor, 0x0, product 0x0, version 0x0
+Type 0x00 (EV_SYN)
+Type 0x01 (EV_KEY)
+ KEY_0258 KEY_0259 KEY_025a KEY_025b
+...
+```
+In this case `/dev/input/event3` is the device node and you can define it as the `sliderDevice` dconf item value and use the number at the end of the device node in the command below.
+
+Now move the tri-state key to it's middle position, run the command below and go through all the positions going top-to-bottom:
+```
+[nemo@OnePlus5 ~]$ evdev_trace -t 3 | grep '1$'
+/dev/input/event3: 1587214927.004 - 0x01/EV_KEY - 0x259/KEY_0259 - 1
+/dev/input/event3: 1587214928.329 - 0x01/EV_KEY - 0x25a/KEY_025a - 1
+/dev/input/event3: 1587214929.648 - 0x01/EV_KEY - 0x25b/KEY_025b - 1
+```
+From this example output we can determine that the key top position yields code `0x259`, middle `0x25a` and bottom `0x25b`, which you can place all in the same order as the `sliderCodes` dconf item value.
|
[-]
[+]
|
Changed |
_service:tar_git:triambienced-1.2.0.tar.bz2/src/uinputevpoll.cpp
^
|
@@ -20,6 +20,13 @@
_polling = false;
_abort = false;
_uinputfd = -1;
+
+ dconfSliderCodes = new MGConfItem("/apps/onyxtristate/sliderCodes");
+ QVariantList sliderCodes = dconfSliderCodes->value(defSliderCodes).toList();
+
+ _sliderCodes[0] = sliderCodes[0].toInt(); // e.g. 0x259
+ _sliderCodes[1] = sliderCodes[1].toInt(); // e.g. 0x25a
+ _sliderCodes[2] = sliderCodes[2].toInt(); // e.g. 0x25b
}
void UinputEvPoll::abort()
@@ -114,11 +121,11 @@
{
if (evs[i].type == EV_KEY && evs[i].value == 1)
{
- if (evs[i].code == 0x259)
+ if (evs[i].code == _sliderCodes[0])
emit tristateChanged("top");
- else if (evs[i].code == 0x25a)
+ else if (evs[i].code == _sliderCodes[1])
emit tristateChanged("middle");
- else if (evs[i].code == 0x25b)
+ else if (evs[i].code == _sliderCodes[2])
emit tristateChanged("bottom");
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:triambienced-1.2.0.tar.bz2/src/uinputevpoll.h
^
|
@@ -9,8 +9,9 @@
#ifndef UINPUTEVPOLL_H
#define UINPUTEVPOLL_H
-#include <QObject>
#include <QMutex>
+#include <QObject>
+#include <mlite5/MGConfItem>
class UinputEvPoll : public QObject
@@ -36,10 +37,13 @@
void readKeyboard(int fd);
QMutex mutex;
+ MGConfItem *dconfSliderCodes;
+ QVariantList defSliderCodes = { 0x259, 0x25a, 0x25b };
bool _polling;
bool _abort;
int _uinputfd;
+ int _sliderCodes[3];
};
#endif // UINPUTEVPOLL_H
|