~maxgyver83

Stuttgart, Germany

https://maximilian-schillinger.de


#243 No battery level in status bar on Nexus 5 1 year, 4 months ago

Comment by ~maxgyver83 on ~mil/sxmo-tickets

OK, I see!

#243 No battery level in status bar on Nexus 5 1 year, 4 months ago

on ~mil/sxmo-tickets

REPORTED RESOLVED FIXED

#243 No battery level in status bar on Nexus 5 1 year, 4 months ago

Comment by ~maxgyver83 on ~mil/sxmo-tickets

Thanks for all your answers and patches and sorry for my late reply. I have tested the master branch and it works when I add a device profile for my Nexus 5. I have created this patch for adding it: https://lists.sr.ht/~mil/sxmo-devel/patches/23640

#242 lisgd: Mixing pixels and millimeters? 1 year, 7 months ago

Comment by ~maxgyver83 on ~mil/sxmo-tickets

Thanks for testing! I'm wondering why it works as it is on the Pinephone. What values do you get for screenwidth and screenheight on the Pinephone? What is the output range of libinput_event_touch_get_x(tevent) and libinput_event_touch_get_x_transformed(tevent, screenwidth)?

#243 No battery level in status bar on Nexus 5 1 year, 7 months ago

Comment by ~maxgyver83 on ~mil/sxmo-tickets

Sounds good! /sys/firmware/devicetree/base/compatible exists on my Nexus 5 and it contains: lge,hammerheadqcom,msm8974.

#243 No battery level in status bar on Nexus 5 1 year, 7 months ago

Ticket created by ~maxgyver83 on ~mil/sxmo-tickets

On my Nexus 5 I don't see the battery level in the status bar. The reason is that the script sxmo-utils/scripts/core/sxmo_statusbar.sh assumes to find the battery level in /sys/class/power_supply/*-battery/capacity. But on my Nexus 5, the path is /sys/class/power_supply/battery/capacity.

This simple patch could fix the status on the Nexus 5 while (probably) keep it working on other devices:

diff --git a/scripts/core/sxmo_statusbar.sh b/scripts/core/sxmo_statusbar.sh
index ae62a9d..76eef93 100755
--- a/scripts/core/sxmo_statusbar.sh
+++ b/scripts/core/sxmo_statusbar.sh
@@ -54,9 +54,9 @@ update() {
        fi

        # Battery pct
-       PCT="$(cat /sys/class/power_supply/*-battery/capacity)"
+       PCT="$(cat /sys/class/power_supply/*battery/capacity)"
        BATSTATUS="$(
-               cat /sys/class/power_supply/*-battery/status |
+               cat /sys/class/power_supply/*battery/status |
                cut -c1
        )"
        if [ "$BATSTATUS" = "C" ]; then

Could this cause problems on other devices? Like matching more than one folder when *battery is used as glob pattern!?

#242 lisgd: Mixing pixels and millimeters? 1 year, 7 months ago

Comment by ~maxgyver83 on ~mil/sxmo-tickets

This patch works on my Nexus 5:

index 124f298..1e60a7a 100644
--- a/lisgd.c
+++ b/lisgd.c
@@ -296,8 +296,8 @@ touchdown(struct libinput_event *e)

        tevent = libinput_event_get_touch_event(e);
        slot = libinput_event_touch_get_slot(tevent);
-       xstart[slot] = libinput_event_touch_get_x(tevent);
-       ystart[slot] = libinput_event_touch_get_y(tevent);
+       xstart[slot] = libinput_event_touch_get_x_transformed(tevent, screenwidth);
+       ystart[slot] = libinput_event_touch_get_y_transformed(tevent, screenheight);
        if (nfdown == 0) clock_gettime(CLOCK_MONOTONIC_RAW, &timedown);
        nfdown++;
 }
@@ -320,8 +320,8 @@ touchmotion(struct libinput_event *e)

        tevent = libinput_event_get_touch_event(e);
        slot = libinput_event_touch_get_slot(tevent);
-       xend[slot] = libinput_event_touch_get_x(tevent);
-       yend[slot] = libinput_event_touch_get_y(tevent);
+       xend[slot] = libinput_event_touch_get_x_transformed(tevent, screenwidth);
+       yend[slot] = libinput_event_touch_get_y_transformed(tevent, screenheight);

        if (have_actmode_pressed) {
                Swipe swipe = gesturecalculateswipe(

Does it work on the Pinephone, too?

#242 lisgd: Mixing pixels and millimeters? 1 year, 7 months ago

Comment by ~maxgyver83 on ~mil/sxmo-tickets

libinput_event_touch_get_x is defined to be in millimeters. But there is also libinput_event_touch_get_x_transformed which seems to be in pixels. Maybe that's the better choice (if it doesn't break lisgd on Pinephone).

#242 lisgd: Mixing pixels and millimeters? 1 year, 7 months ago

Ticket created by ~maxgyver83 on ~mil/sxmo-tickets

I have installed postmarketOS with sxmo on my Nexus 5. Gestures didn't work at all. I have added some debugging output and recompiled. Then I saw that screenwidth and screenheight is in pixels (1080x1920) but touch coordinates are in millimeters (about 60x112). When I multiply the output of libinput_event_touch_get_x(tevent) (and ...get_y) by 17.4, lisgd works as expected.

I can't imagine I'm the first one to notice this. How is it supposed to be: Everything in pixels or everything in millimeters?