Jump to content

Charging-sdl: Difference between revisions

From postmarketOS Wiki
Drebrez (talk | contribs)
Created page with "This is an application developed by the postmarketOS community to display the charging status when the device is powered on in "charge mode". It is written in C and uses SDL2..."
 
update to gitlab.postmarketos.org
 
(16 intermediate revisions by 13 users not shown)
Line 1: Line 1:
{{note|Currently charging-sdl is disabled by default, see {{issue|1064|pmaports}}.}}
This is an application developed by the postmarketOS community to display the charging status when the device is powered on in "charge mode".
This is an application developed by the postmarketOS community to display the charging status when the device is powered on in "charge mode".


It is written in C and uses SDL2/SDL_power to query the battery information. The <code>charging-sdl</code> package is part of postmarketOS's aports.
It is written in C and uses SDL2/SDL_power to query the battery information. The {{pmaport|charging-sdl}} package is part of postmarketOS's aports.


== Reporting Issues ==
== Reporting issues ==


Issues with <code>charging-sdl</code> should be reported on [https://github.com/postmarketOS/charging-sdl/issues the project github issues page].
Issues with <code>charging-sdl</code> should be reported on [https://gitlab.postmarketos.org/postmarketOS/charging-sdl/issues the project GitLab issues page].


== Current implementation ==
== Current implementation ==


If you connect the usb cable to the phone while it's powered off, it should start the device as usual and in the initramfs it should detect that it's started in "charge mode" and show the <code>charging-sdl</code> for 5 seconds.
Connecting the usb cable to the phone while it's powered off should start the device as usual and in the initramfs it should detect that it's started in "charge mode", showing the <code>charging-sdl</code> for 5 seconds.


Then you can show again the <code>charging-sdl</code> for another 5 seconds by pressing the power key.
You can show this <code>charging-sdl</code> screen again for another 5 seconds by pressing the power key.


If the <code>charging-sdl</code> shows a lightning icon in the top left of the screen, it means that the battery it's charging, if you unplug it, the icon should disappear.
<code>charging-sdl</code> will show a lightning icon in the top left of the screen when the battery is charging, and if you unplug it the icon should disappear.


== Run charging-sdl manually ==
== Run charging-sdl manually ==


You first have to boot the device into the <code>debug-shell</code>. (See [[Inspecting_the_initramfs]])
You first have to boot the device into the <code>debug-shell</code>. (See [[Inspecting the initramfs]])


After you connected to the device using telnet, you can run:
After you connected to the device using telnet, you can run:
<syntaxhighlight lang="shell-session">
<syntaxhighlight lang="shell-session">
$ source /init_functions.sh
$ source /init_functions.sh
$ mount_boot_partition
$ mount_boot_partition /boot
$ extract_initramfs_extra /path/to/initramfs-extra      (e.g. /boot/initramfs-samsung-i9070-extra)
$ extract_initramfs_extra /boot/*-extra
$ setup_directfb_tslib
$ setup_directfb_tslib
$ fontpath=$(awk '/^keyboard-font/{print $3}' /etc/osk.conf)
$ fontpath=$(awk '/^keyboard-font/{print $3}' /etc/osk.conf)
Line 33: Line 35:
==== Charge mode not detected ====
==== Charge mode not detected ====


In order to detect if the device has been powered on in "charge mode", the initramfs script looks for specific options in the kernel cmdline (e.g.: androidboot.mode=charger)
In order to detect if the device has been powered on in "charge mode", the initramfs script looks for specific options in the kernel cmdline (e.g.: androidboot.mode=charger).


Compare your kernel cmdline when powered on normally and when you power on by connecting the usb cable only.  
Kernel cmdline is the arguments Linux uses to boot. See [https://gitlab.postmarketos.org/postmarketOS/pmaports/blob/master/device/testing/device-lg-bullhead/deviceinfo#L23 this example].
If you find a specific option to distinguish the two boot modes, please update the [https://github.com/postmarketOS/pmbootstrap/blob/a7afd519eff34237dfe2766634ac6b2c5076e9f5/aports/main/postmarketos-mkinitfs/init_functions.sh#L289-L297 initramfs script].
 
Compare your kernel cmdline when powered on normally to when you power on by connecting the usb cable only.  
If you find a specific option to distinguish the two boot modes, please update the [https://gitlab.postmarketos.org/postmarketOS/pmaports/blob/master/main/postmarketos-mkinitfs/init_functions.sh#L509-516 initramfs script].


==== DirectFB/FBDev: No supported modes found in /etc/fb.modes and current mode not supported! ====
==== DirectFB/FBDev: No supported modes found in /etc/fb.modes and current mode not supported! ====


See [https://wiki.postmarketos.org/wiki/Osk-sdl#DirectFB.2FFBDev:_No_supported_modes_found_in_.2Fetc.2Ffb.modes_and_current_mode_not_supported.21 osk-sdl troubleshooting page]
See [https://wiki.postmarketos.org/wiki/Osk-sdl#DirectFB.2FFBDev:_No_supported_modes_found_in_.2Fetc.2Ffb.modes_and_current_mode_not_supported.21 osk-sdl troubleshooting page]
[[Category:Technical Reference]]

Latest revision as of 06:55, 3 November 2024

Note Currently charging-sdl is disabled by default, see pmaports#1064.

This is an application developed by the postmarketOS community to display the charging status when the device is powered on in "charge mode".

It is written in C and uses SDL2/SDL_power to query the battery information. The charging-sdlPMOS package is part of postmarketOS's aports.

Reporting issues

Issues with charging-sdl should be reported on the project GitLab issues page.

Current implementation

Connecting the usb cable to the phone while it's powered off should start the device as usual and in the initramfs it should detect that it's started in "charge mode", showing the charging-sdl for 5 seconds.

You can show this charging-sdl screen again for another 5 seconds by pressing the power key.

charging-sdl will show a lightning icon in the top left of the screen when the battery is charging, and if you unplug it the icon should disappear.

Run charging-sdl manually

You first have to boot the device into the debug-shell. (See Inspecting the initramfs)

After you connected to the device using telnet, you can run:

$ source /init_functions.sh
$ mount_boot_partition /boot
$ extract_initramfs_extra /boot/*-extra
$ setup_directfb_tslib
$ fontpath=$(awk '/^keyboard-font/{print $3}' /etc/osk.conf)
$ charging-sdl -pcf "$fontpath"

Troubleshooting

Charge mode not detected

In order to detect if the device has been powered on in "charge mode", the initramfs script looks for specific options in the kernel cmdline (e.g.: androidboot.mode=charger).

Kernel cmdline is the arguments Linux uses to boot. See this example.

Compare your kernel cmdline when powered on normally to when you power on by connecting the usb cable only. If you find a specific option to distinguish the two boot modes, please update the initramfs script.

DirectFB/FBDev: No supported modes found in /etc/fb.modes and current mode not supported!

See osk-sdl troubleshooting page