|
2016-01-03
, 16:03
|
|
Posts: 394 |
Thanked: 1,341 times |
Joined on Dec 2009
|
#322
|
The Following 2 Users Say Thank You to velox For This Useful Post: | ||
|
2016-01-03
, 16:30
|
Posts: 307 |
Thanked: 488 times |
Joined on Sep 2010
@ USA around Chicago
|
#323
|
Oh great, thank you. Now, we just need to package this into something more usable than a terminal. Personaly, I can't, but I would greatly appreciate
#!/bin/bash FLASHCTL=/sys/class/leds/led\:flash_torch/brightness FLASHON=`cat $FLASHCTL` if [ "$FLASHON" == 0 ] then /bin/echo 1 > $FLASHCTL else /bin/echo 0 > $FLASHCTL fi
[Desktop Entry] Type=Application Icon=flashlight Exec=/home/nemo/scripts/flashlight.sh Name=Flash Light
chmod 755 /home/nemo/scripts/flashlight.sh
|
2016-01-03
, 19:50
|
Posts: 602 |
Thanked: 735 times |
Joined on Mar 2011
@ Nantes, France
|
#324
|
The Following 2 Users Say Thank You to romu For This Useful Post: | ||
|
2016-01-03
, 20:09
|
|
Posts: 654 |
Thanked: 2,368 times |
Joined on Jul 2014
@ UK
|
#325
|
Since the file is owned by root:root, it will probably require changing permissions/ownership of that file so that the app can write to it
nemo ~ $ ls -l /sys/class/leds/led\:rgb_red/ total 0 -rw-r--r-- 1 system system 4096 Dec 31 00:03 blink_delay_off -rw-r--r-- 1 system system 4096 Dec 31 00:03 blink_delay_on -rw-r--r-- 1 system system 4096 Dec 31 00:03 brightness lrwxrwxrwx 1 root root 0 Jan 3 20:04 device -> ../../../pm8xxx-led -rw-r--r-- 1 root root 4096 Dec 31 00:03 max_brightness drwxr-xr-x 2 root root 0 Jan 3 20:04 power lrwxrwxrwx 1 root root 0 Jan 3 20:04 subsystem -> ../../../../../../../class/leds -rw-r--r-- 1 root root 4096 Jan 3 20:04 uevent
The Following User Says Thank You to Feathers McGraw For This Useful Post: | ||
|
2016-01-03
, 20:51
|
|
Posts: 654 |
Thanked: 2,368 times |
Joined on Jul 2014
@ UK
|
#326
|
|
2016-01-03
, 21:10
|
|
Posts: 411 |
Thanked: 1,105 times |
Joined on Jan 2010
@ Europe
|
#327
|
So I made an app:
http://i.imgur.com/ZytGbjP.png
I don't have a N5 yet so if someone can test for me I'd really appreciate it! RPMs are attached. I'll upload the source to Github after posting this.
It works fine editing a file in /home/nemo in the emulator, but I can't create the file /sys/class/leds/led:flash_torch/brightness in the emulator which is really annoying!
So I think it will work, but it might not.
Also, can someone explain what the difference between debug and release modes is in the SDK? I thought release mode just removed debugging symbols or something like that, but I get no errors compiling in debug mode and lots in release mode
The Following 2 Users Say Thank You to BluesLee For This Useful Post: | ||
|
2016-01-03
, 21:18
|
|
Posts: 654 |
Thanked: 2,368 times |
Joined on Jul 2014
@ UK
|
#328
|
|
2016-01-03
, 21:23
|
|
Posts: 411 |
Thanked: 1,105 times |
Joined on Jan 2010
@ Europe
|
#329
|
"muh first app"!
Did you have to change any permissions?
Only thing that's bugging me about it is that if you toggle the flashlight from the cover action it won't update the icon when you open the main page and vice versa.
On "traditional" Qt I'd do this with signals and slots but it's taking a while to get my head around Qml and the docs aren't great either compared to normal Qt, which is understandable.
The best I could do for now is to use onStatusChanged on the main page (see here), but that only works when switching between pages within the app (try main page to about and back, and it will refresh); it doesn't work when switching between the cover and the app itself.
Are there any signals for when different pages gain focus or anything like that?
The Following 2 Users Say Thank You to BluesLee For This Useful Post: | ||
|
2016-01-03
, 22:41
|
|
Posts: 394 |
Thanked: 1,341 times |
Joined on Dec 2009
|
#330
|
Are there any signals for when different pages gain focus or anything like that?
Image { source: ( led.isOnBool ) ? "qrc:///hammerhead-inverted" : "qrc:///hammerhead" }
The Following 2 Users Say Thank You to velox For This Useful Post: | ||
Since the file is owned by root:root, it will probably require changing permissions/ownership of that file so that the app can write to it, at least until I can work out how to turn it on the "right way".
Seems like the kind of thing libhybris handles, but I couldn't find any info on how to actually use it. Anyone know how?