Skip to content

Instantly share code, notes, and snippets.

@wdehoog
Last active October 30, 2019 13:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wdehoog/c7c09a792799d03e6880e10dbc19ab33 to your computer and use it in GitHub Desktop.
Save wdehoog/c7c09a792799d03e6880e10dbc19ab33 to your computer and use it in GitHub Desktop.
testing led indicator in repowerd
I hope some people can find some time to try my work on led indicator support.
Since I only test on my Oneplus One I am especially curious what happens on other phones.
Sources can be found in the add-light branch of repo https://github.com/wdehoog/repowerd
See also https://forums.ubports.com/topic/3292/support-for-led-notifications/2
How I test:
- make system writable (if you don't know how then stop here)
- edit /etc/init/repowerd.conf and comment out the line with 'respawn'
(now if you kill the original repowerd it will not be restarted)
- download com.ubports.lightcontrol.conf and save it in /etc/dbus-1/system.d/
(this handles dbus permissions)
- kill the repowerd process
- download the new repowerd-<hash> binary and make it executable (chmod +x)
- run from a terminal: sudo REPOWERD_LOG=console ./repowerd
(stop it with ctrl-c)
When done don't forget to uncomment the 'respawn' line in /etc/init/repowerd.conf
First: the 'unread notifications' is not yet supported so it will not work correctly.
In theory it can indicate battery low/charging/full. You can also play with it with dbus (see below)
Show API:
dbus-send --system --type=method_call --print-reply --dest=com.ubports.lightcontrol /com/ubports/lightcontrol org.freedesktop.DBus.Introspectable.Introspect
Activate/Deactivate Bluetooth:
dbus-send --system --type=method_call --print-reply --dest=com.ubports.lightcontrol /com/ubports/lightcontrol com.ubports.lightcontrol.notifyLightEvent string:BluetoothEnabled int32:1
dbus-send --system --type=method_call --print-reply --dest=com.ubports.lightcontrol /com/ubports/lightcontrol com.ubports.lightcontrol.notifyLightEvent string:BluetoothEnabled int32:0
===
Enable playing:
dbus-send --system --type=method_call --print-reply --dest=com.ubports.lightcontrol /com/ubports/lightcontrol com.ubports.lightcontrol.enableLightEvent string:Playing
dbus-send --system --type=method_call --print-reply --dest=com.ubports.lightcontrol /com/ubports/lightcontrol com.ubports.lightcontrol.notifyLightEvent string:Playing int32:1
Now play:
dbus-send --system --type=method_call --print-reply --dest=com.ubports.lightcontrol /com/ubports/lightcontrol com.ubports.lightcontrol.setPlayingData string:0xAAAAAA int32:1000 int32:1000
Done Playing:
dbus-send --system --type=method_call --print-reply --dest=com.ubports.lightcontrol /com/ubports/lightcontrol com.ubports.lightcontrol.disableLightEvent string:Playing
dbus-send --system --type=method_call --print-reply --dest=com.ubports.lightcontrol /com/ubports/lightcontrol com.ubports.lightcontrol.notifyLightEvent string:Playing int32:0
<!-- This configuration file specifies the required security policies
for Light Control to work. -->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- Only the root user can own -->
<policy user="root">
<allow own="com.ubports.lightcontrol"/>
</policy>
<!-- Allow any user at console (adb shell) -->
<policy at_console="true">
<allow send_destination="com.ubports.lightcontrol"/>
</policy>
<!-- Allow any user on LightControl -->
<policy context="default">
<allow send_destination="com.ubports.lightcontrol"/>
<allow send_interface="com.ubports.lightcontrol"/>
</policy>
</busconfig>
This file has been truncated, but you can view the full file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment