Open DrewNaylor opened 3 years ago
Actually, perhaps I could develop my own library by using various documentation from Megi, since there's a lot of good stuff there. I can also use ofonocli from Martijn Braam to get modem info for apps in UIs that use it as well as mmcli for ModemManager (this'll eventually be the default for Plasma Mobile, so I should probably focus on it). Here's a page on ofonocli commands: https://sr.ht/~martijnbraam/ofonoctl/ mmcli commands: https://www.chromium.org/chromium-os/how-tos-and-troubleshooting/debugging-3g/modem-debugging-with-mmcli
A bit more research on this shows that mmcli -m 0 -K
will give values in key-value pairs, which will make displaying signal strength and whether the sim card is in or not easy as long as I clean up the output for processing. The "-K" argument was in a comment on the accepted answer to this question:
https://unix.stackexchange.com/questions/586528/gsm-modem-get-signal-strength
Decided to run ofonoctl
on its own, and it shows the available modems along with their status.
Even if I do write my own library (which I will, since I can fine-tune it to what I need while avoiding licensing issues), I'll still have to ensure people can install libraries to support other devices. Perhaps a "dummy library" that acts as a bridge interface would work, so that other libraries can just be connected to and provide data back and forth using that bridge. (Not sure how that would be implemented to switch libraries at runtime, though). If I don't do that, then more work will have to be done, resulting in duplicated code. I may have to have general hardware sensors and stuff separate from code that interacts with mmcli
, since that would probably be more common across Linux phones than would general hardware stuff. Hopefully most phones can just be supported with different config files rather than a customized hardware support library, as that would be way easier.
As I mentioned above regarding plugins, I'm going to have to have an easy way to support multiple devices. I thought of a name for the ones that only involve running different commands such as when toggling the flashlight: Generic Driver Configuration Architecture, or GDCA (it could also be named "Generic Driver Engine for Retiled (Configuration Architecture)", or "GDER(CA)", with the "CA" possibly being added when describing the file format for the "Generic Driver Engine for Retiled", which would be the software and libraries themselves that read the configuration files). I probably described the idea for these somewhere, but they're just INI config files that specify what command should be run when something wants to for example do flashlight_on
. But still, some devices won't just be fine with commands, so we may need to expand the capabilities of these config files to take into account watching the device's rotation and volume and stuff if that can't be done using configs (but it should be able to, even if like the rotation has to be read from sysfs instead of running a command; actually, maybe that could work, have a D-Bus server watching for updated from the rotation then sending it out when it hits a specific angle, but we have to also have a way to make it pause reading the value if rotation lock is off)
Not sure if I described this anywhere yet, but I think the file tree can be for example, (repo root)/drivers/pinephone/hardware_v1.2-beta.ini
. A better layout probably exists. There also needs to be a way for specific operating systems to have their own config file, maybe with hardware_v1.2-beta_manjaro-plasmamobile.ini
for an example file. First we'll look for the most specific file (one containing the environment, OS, and hardware revision), then the hardware revision, then just hardware.ini
. Maybe there can also be a way to have files for specific components, if only a few things change between hardware revisions or operating systems. This can be (for example) flashlight.ini
, along with the hardware revision and operating system strings and stuff.
As likely mentioned before, we need to also offer a way for the user to pick their configuration file directly in case we decide incorrectly, such as on a modified device that hasn't called themselves something different from something we support yet, or if a device is close enough to something else to mostly work, like with OnePlus and the other company I forgot (but I don't know how similar the devices are from those two companies, so changes may be necessary).
Adding to this, rotation axis can be determined via sysfs iio, and what the PinePhone uses is described on the page for it on the postmarketOS Wiki under Components, Sensors: https://wiki.postmarketos.org/wiki/PINE64_PinePhone_(pine64-pinephone)
Not sure if it's possible or even a good idea to constantly read it, so maybe polling every 60-300 ms will be necessary. This number is subject to change, and it would be a good idea to allow it to be customized by the user in an advanced settings page somewhere. Rotation Lock will turn off polling for rotation, and apps need to have a way to say that they don't want to rotate, or that they want to stay in a specific orientation. Not sure how to handle apps that want to get rotation info with Rotation Lock off.
Edit: This page has degree values for when a rotation occurs, that being at 60 degrees when going from portrait to landscape left or right or back to portrait (depending on the tilt direction), and 30 degrees up when flat on a table in landscape left or right going to portrait. Also, the status bar goes from 32 pixels in portrait to 72 in landscape. Finally, physical horizontal keyboards would rotate the display horizontally for that keyboard, so there needs to be support to automatically do that, for example with the F(x)tec Pro1 and the Astro Slide; the PinePhone Keyboard Case is always open when using the phone's touch screen, so that wouldn't work. Source and screenshots for archival: https://learn.microsoft.com/en-us/previous-versions/windows/apps/hh202911(v=vs.105)
Qt has window orientation flags apparently, where they're defined here (this is my copy of the repo) : https://github.com/drewnaylor/qtwayland/blob/dev/src/extensions/surface-extension.xml
Learned about that file from this issue: https://github.com/libsdl-org/SDL/issues/1826
Obviously, InvertedLandscapeOrientation
is what we'll use for rotating the other way, and also for the compositor to move system UI stuff like the status and navigation bars as necessary. Might look a bit janky at first, but if it works, it's fine until it's polished.
Also in that file are window flags, such as OverridesSystemGestures
, StaysOnTop
, and BypassWindowManager
. Not sure how BypassWindowManager
could be used, but OverridesSystemGestures
sounds like could be used to turn off the "swipe to hide navigation bar" feature (then it would just always be on screen, so the user can easily access it), and it would also make the Action Center just have the small bar so it has to be pulled down twice to open.
(This will be edited to be more concise; just copying over things for now.)
(note Oct. 3, 2023: I'm relicensing to the GPL, so I'll just use the idea with the Generic Driver thing I have to support multiple devices)
Discussed in https://github.com/DrewNaylor/Retiled/discussions/16