maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   SailfishOS 2.0 on Nexus 5 (https://talk.maemo.org/showthread.php?t=94620)

Feathers McGraw 2016-01-03 12:25

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by romu (Post 1493418)
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 :D

I started an app called Hammerhead Torch yesterday, with a bit of luck I should finish today :) seemed like a neat little project for my first Sailfish app.

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?

velox 2016-01-03 16:03

Re: SailfishOS 2.0 on Nexus 5
 
I have never done something like this (and it sounds like the wrong thing to do), but you might be able to add chmod commands to a %post script (don't forget to undo on %postun if it even works) in your rpm spec file to change permissions on installation…

abyzthomas 2016-01-03 16:30

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by romu (Post 1493418)
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 :D

Here is a way you can do it.

I would create a folder called scripts under nemo home directory so you can keep your scripts together. It is not are requirement.

Create a file /home/nemo/scripts/flashlight.sh and copy the following to it.

Code:

#!/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

Create the icon file /usr/share/applications/flashlight.desktop and copy the following. Icon=flashlight expects a png file in /usr/share/icons/hicolor/86x86/apps/flashlight.png

Code:

[Desktop Entry]
Type=Application
Icon=flashlight
Exec=/home/nemo/scripts/flashlight.sh
Name=Flash Light

The above will create an icon that turns flashlight on and off.

Hope this helps to get you going.

Edit:

Make sure the script is executable.
Code:

chmod 755 /home/nemo/scripts/flashlight.sh

romu 2016-01-03 19:50

Re: SailfishOS 2.0 on Nexus 5
 
@abyzthomas: it works...almost. It doesn't behave like a regular SFOS application, so it's not obvious about how to close it properly. But that's better than nothing. Thanks a lot.

Feathers McGraw 2016-01-03 20:09

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by Feathers McGraw (Post 1493428)
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

Actually I think I might have been wrong there. nemo belongs to the "system" group, and (on the Jolla phone at least) some of those LED files are owned by system:system.

Code:

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


What are the permissions/ownership of the files on the N5?
I haven't actually received mine yet!

Feathers McGraw 2016-01-03 20:51

Re: SailfishOS 2.0 on Nexus 5
 
3 Attachment(s)
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.

EDIT: sauce https://github.com/sam-hobbs/harbour-hammerhead-torch

EDIT: now on openrepos https://openrepos.net/content/feathe...mmerhead-torch

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 :confused:

BluesLee 2016-01-03 21:10

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by Feathers McGraw (Post 1493532)
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 :confused:

Perfect! Nice shark indication of activity by the way.

Feathers McGraw 2016-01-03 21:18

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by BluesLee (Post 1493534)
Works perfectly! Nice shark indication of activity the way.

:D:D "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?

BluesLee 2016-01-03 21:23

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by Feathers McGraw (Post 1493536)
:D:D "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?

No, i did not change any permissions. You are right regarding toggling and the behaviour between main page and cover.

velox 2016-01-03 22:41

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by Feathers McGraw (Post 1493536)
Are there any signals for when different pages gain focus or anything like that?

I hope I understood your underlying problem, because I think it should work without listening for focus: You could make a bool property in your LEDControl in the main qml which you can query in all other qml files with something like
Code:

    Image {
        source: ( led.isOnBool ) ? "qrc:///hammerhead-inverted" : "qrc:///hammerhead"
    }

and would not have to set the source/whatever manually on change, just set the bool.

Feathers McGraw 2016-01-03 23:15

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by velox (Post 1493547)
You could make a bool property in your LEDControl in the main qml which you can query in all other qml files

If that works it'll be perfect! Are you sure there's no need to trigger the window to redraw or anything?

velox 2016-01-03 23:32

Re: SailfishOS 2.0 on Nexus 5
 
It should work. QML has automagical data bindings for most things. :)

Bundyo 2016-01-04 04:17

Re: SailfishOS 2.0 on Nexus 5
 
Btw, there's a Settings LED plugin in OpenRepos, why not add the support in it instead? Would be easier to use than a separate app.

Feathers McGraw 2016-01-04 20:48

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by velox (Post 1493555)
It should work. QML has automagical data bindings for most things. :)

It worked! I had to add a Q_PROPERTY in the C++ class, with read/write/notify methods. Thanks so much for giving me that hint, it's was just the information I needed.

There's a new version of Hammerhead Torch on openrepos, the cover and icon button should now be synchronised.

Quote:

Originally Posted by Bundyo (Post 1493571)
Btw, there's a Settings LED plugin in OpenRepos, why not add the support in it instead?

I can't find it, can you give me a link? I wanted to make a Sailfish app because I haven't made one before, but I don't have anything against contributing to that too if people would use it.

Bundyo 2016-01-04 21:34

Re: SailfishOS 2.0 on Nexus 5
 
Should be this one:

https://openrepos.net/content/sfietk...jolla-settings

Feathers McGraw 2016-01-04 22:07

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by Bundyo (Post 1493678)

Thanks :) I can't see a link to the source though...if it's all qml I might be able to extract it from the rpm, but I have no idea how it's licensed.

Bundyo 2016-01-04 22:18

Re: SailfishOS 2.0 on Nexus 5
 
https://github.com/SfietKonstantin/jolla-settings-torch

;)

jetronic 2016-01-04 22:22

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by romu (Post 1493418)
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 :D

That's right, it's not really comfortable on the terminal.
Does anyone know if you can run a script from the surface?
Or do we need here is a small app for the Nexus 5?

Can someone post the result of an Jolla Phone from the following line:
Code:

ll /sys/class/leds/
Maybe we can use the existing Flashlight Apps with the N5,
with a corresponding symlink in Fliesystem.

Edit:
oh, I should upgrade my browser page.
Sorry, the post can be ignored

abyzthomas 2016-01-05 02:59

Re: SailfishOS 2.0 on Nexus 5
 
1 Attachment(s)
Quote:

Originally Posted by jetronic (Post 1493689)
Can someone post the result of an Jolla Phone from the following line:
Code:

ll /sys/class/leds/

Code:

root@Jolla leds]# ll /sys/class/leds/
total 0
lrwxrwxrwx 1 root root 0 1970-02-14 02:12 blue -> ../../devices/leds-qpnp-f859d800/leds/blue
lrwxrwxrwx 1 root root 0 1970-02-14 02:12 green -> ../../devices/leds-qpnp-f859d800/leds/green
lrwxrwxrwx 1 root root 0 1970-02-14 02:12 lcd-backlight -> ../../devices/mdp.0/qcom,mdss_fb_primary.161/leds/lcd-backlight
lrwxrwxrwx 1 root root 0 2016-01-05 08:24 led:flash_0 -> ../../devices/leds-qpnp-f859da00/leds/led:flash_0
lrwxrwxrwx 1 root root 0 2016-01-05 08:24 led:flash_1 -> ../../devices/leds-qpnp-f859da00/leds/led:flash_1
lrwxrwxrwx 1 root root 0 2016-01-05 06:22 led:flash_torch -> ../../devices/leds-qpnp-f859da00/leds/led:flash_torch
lrwxrwxrwx 1 root root 0 2016-01-05 08:24 mmc1:: -> ../../devices/msm_sdcc.1/leds/mmc1::
lrwxrwxrwx 1 root root 0 1970-02-14 02:12 red -> ../../devices/leds-qpnp-f859d800/leds/red

I think you are on to something :):).

On N5 following 2 folders exists:
/sys/devices/leds-qpnp-f859da00/leds/
/sys/devices/leds-qpnp-f859d800/leds/

links in /sys/class/leds seems to be pointing to
/sys/devices/leds-qpnp-f859da00/leds

See attachment for more file listings.
Attachment 38024

Hope this helps.

juiceme 2016-01-05 05:45

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by Bundyo (Post 1493687)

WHAT! This is crazy, there absolutely needs to be another way of enabling the backside led!
This application creates a dummy video feed just to enable the led for illuminating purposes, there should be no need to start the camera for it :p

romu 2016-01-05 13:09

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by juiceme (Post 1493702)
WHAT! This is crazy, there absolutely needs to be another way of enabling the backside led!
This application creates a dummy video feed just to enable the led for illuminating purposes, there should be no need to start the camera for it :p

Don't worry, it doesn't work on the N5. :D

@jetronic: the app is done, just go back to few previous messages and you'll find it.

nh1402 2016-01-05 20:23

Re: SailfishOS 2.0 on Nexus 5
 
screenshot
Remember this is still violently alpha quality. But we can now get Internet access working in Android via the fake wifi connection xposed module, flashing gapps work, logging in to your existing google account to gain access to the google play store all work. Yes whatsapp works (but contact sync does not) you can restore your conversation backup and then send messages to those people however.

romu 2016-01-05 20:34

Re: SailfishOS 2.0 on Nexus 5
 
Impressive @nh1402!

nh1402 2016-01-05 21:21

Re: SailfishOS 2.0 on Nexus 5
 
Updated the piratepad for how to get to the same stage.

http://piratepad.net/FtZYtm4tDY

tomislav 2016-01-06 10:59

Re: SailfishOS 2.0 on Nexus 5
 
Will this port work on Android 6.0.1

pagis 2016-01-06 11:48

Re: SailfishOS 2.0 on Nexus 5
 
I have to restart the phone from time to time as the touch screen is not responsive. I am not sure if it is caused by enabling LPM (mce-tool) or the bad state of my nexus5.

Has anyone experienced such behaviour?

Drekkie 2016-01-06 13:08

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by pagis (Post 1493867)
I have to restart the phone from time to time as the touch screen is not responsive. I am not sure if it is caused by enabling LPM (mce-tool) or the bad state of my nexus5.

Has anyone experienced such behaviour?

I've got LPM enabled on my Nexus 5 and my touchscreen doesn't freeze. Closest thing to that is that occasionally my apps get locked to landscape orientation and won't flip back to portrait without a reboot ( i realize this has nothing to do with your question) .

romu 2016-01-06 13:37

Re: SailfishOS 2.0 on Nexus 5
 
Touchscreen freeze happens from time to time on my N5. I'm using my N5 as my only phone for more than 6 months now, and I've got 2/3 freezes.

Regarding orientation, did you try to restart the sensor framework? This could prevent to reboot the whole phone.

abyzthomas 2016-01-06 13:44

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by pagis (Post 1493867)
I have to restart the phone from time to time as the touch screen is not responsive. I am not sure if it is caused by enabling LPM (mce-tool) or the bad state of my nexus5.

Has anyone experienced such behaviour?

I think it happens whether LPM is enabled or not. I don't have it enabled but still happens often.

Observations!

1. After the screen wakes up for an alert, if I press the power button at some specific moment, right before it goes back to sleep. It usually happens only if I pressing power button to unlock.

2. Sometimes while on phone a call, maybe when remote end hangs up before you? Not sure, but there is a specific event that is causing it here also.

Solution? Just reboot! :):) Still very happy sailing on N5!!! :):):)

Drekkie 2016-01-06 15:00

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by romu (Post 1493883)

Regarding orientation, did you try to restart the sensor framework? This could prevent to reboot the whole phone.

Thanks for the idea. Haven't figured out how to do that but if i do and it works i'll report back.

oenone 2016-01-06 16:05

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by abyzthomas (Post 1493884)
I think it happens whether LPM is enabled or not. I don't have it enabled but still happens often.

Observations!

1. After the screen wakes up for an alert, if I press the power button at some specific moment, right before it goes back to sleep. It usually happens only if I pressing power button to unlock.

2. Sometimes while on phone a call, maybe when remote end hangs up before you? Not sure, but there is a specific event that is causing it here also.

Solution? Just reboot! :):) Still very happy sailing on N5!!! :):):)

I can confirm that I get this behaviour. Not sure if I have LPM enabled or not, but yes, it does sometimes go to sleep if one presses the power button about when the screen awakens from an alert that it goes to sleep, and then one fights with the power button to turn the screen back one.

Also can confirm that I have had the issue with the phone going to sleep after a phone call has been terminated by the other party.

And I have also had the phone lock in one orientation and not want to switch when tilted.

Rebooting works wonders in all cases. It is good that Sailfish is fast to reboot, as for example BlackBerry 10 takes eons to reboot, both to shut down and to start up.

BluesLee 2016-01-06 16:16

Re: SailfishOS 2.0 on Nexus 5
 
A lot of new names here. Please keep in mind that all mentioned issues are not new and that you can contribute to the bugtracker so that developers see how important it is to fix those https://bugs.nemomobile.org

tomislav 2016-01-06 18:01

Re: SailfishOS 2.0 on Nexus 5
 
Does this port work on 6.0.1 also with dual boot

romu 2016-01-06 19:18

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by Drekkie (Post 1493891)
Thanks for the idea. Haven't figured out how to do that but if i do and it works i'll report back.

1. Open a terminal
2. devel-su
3. systemctl restart sensorfwd
4. exit (2 times)

Drekkie 2016-01-06 19:28

Re: SailfishOS 2.0 on Nexus 5
 
Thanks, i also found the bug in the wiki for the orientation freeze discussion and will try capturing some verbose sensorfwd output when it happens again.

romu 2016-01-06 20:05

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by Drekkie (Post 1493923)
Thanks, i also found the bug in the wiki for the orientation freeze discussion and will try capturing some verbose sensorfwd output when it happens again.

Could you please give the bug link? I'll also try to help by posting some logs.

Drekkie 2016-01-06 20:26

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by romu (Post 1493926)
Could you please give the bug link? I'll also try to help by posting some logs.

Sure, should be this one.

https://bugs.nemomobile.org/show_bug.cgi?id=820

The discussion towards the end of it is explicitly about debugging the orientation freeze, where repro/logs are requested.

tomislav 2016-01-06 21:50

Re: SailfishOS 2.0 on Nexus 5
 
Does this port work on 6.0.1 also with dual boot

Feathers McGraw 2016-01-06 23:20

Re: SailfishOS 2.0 on Nexus 5
 
I've updated Hammerhead torch so it works with jPhone as well, since I don't have my hammerhead yet could someone please test that it still works OK? I had to change the method of writing to the file because the jPhone control file is weird.

Latest versions (0.4) is available on openrepos.

weqaz 2016-01-07 10:23

Re: SailfishOS 2.0 on Nexus 5
 
Quote:

Originally Posted by Feathers McGraw (Post 1493943)
I've updated Hammerhead torch so it works with jPhone as well, since I don't have my hammerhead yet could someone please test that it still works OK? I had to change the method of writing to the file because the jPhone control file is weird.

Updated and tested on Nexus 5, still works OK :)


All times are GMT. The time now is 12:07.

vBulletin® Version 3.8.8