Skip to content

Working#8

Open
komacke wants to merge 76 commits intomasterfrom
working
Open

Working#8
komacke wants to merge 76 commits intomasterfrom
working

Conversation

@komacke
Copy link
Copy Markdown
Owner

@komacke komacke commented Oct 15, 2024

No description provided.

Change pid and lock file locations to use systemd's /run rather than /tmp. The folder
/run/pijuice/ needs to be created by systemd-tmpfiles so we need a config file to
create the folder and set the right permissions.

In pijuice_gui.py fix raw string declaration with backslashes by prefixing the strings with
'r'. This is required starting with python 3.12 (https://docs.python.org/3/whatsnew/3.12.html).
Under Fedora 39 with kernel 6.5.6, loading the module rtc_ds1307 does
not result in a functioning RTC. The clock needs to be read (woken up?)
before the module is loaded. This change adds a read of the clock with a
timeout.

In addition, the /dev/rtc device file takes a fraction of a second to
load so the test for its existence alway fails. A 1 second sleep gives
time for the file to be created.

It's not clear to me if eventually this will be required for Raspberry
OS when it eventually gets to the 6.5.6 kernel. However it seems this
change should always work on kernel 5.

Also fix a misspelling of module in the success message.
- add a udev rule to put pijuice into the i2c group
- pijuice.service is for all systemd distis so put into data/
- draft spec file for base
- allow *.spec files in .gitignore
- initial pijuice-gui.spec file
The base and gui spec files do an install and uninstall. The spec files
look for a tarball of the Source/ folder. The first-prep scripts
create the tarball.
1) pull version from pijuice.py.__version__ list debian does
2) set in rpm spec files before creating tarballs
3) rename the 'first' script to denote making the source tarball
4) unify and parameterize the tarball scripts
The parameterized spec file name was lost in the last commit which
unifies the scripts for building the source tar. symlink them so they
stay the same.
When the RTC is reset to 0, for example from a loss of battery, it wreaks
havoc on the systemd log and probably other subsystems. systemd will set
the system time based on a recent file timestamp in the filesystem (how it
does this depends if chrony or systemd.timesync is being used). But then when
rtc_ds1307 loads, the kernel module sets the system time to the RTC's Jan 1,
2000. If network time is running it will eventually figure it out but the
logs are messed up with the huge jumps in time.

The best place to address this is just before the modprobe of
rtc_ds1307. If the year is 2000, then most certainly the RTC has been
reset. The convenient SetTime() method sets it to the current system
time which is most certainly much closer to the correct time than
year 2000.
- make the xhost config executable; it seems to be ok not so but all the
  other files in the target folder are executable
- add i2c_bus config with a default of 1 to the config json. if one runs
  kernel dtb it enumerates to 3 so make it easy to change if desired
The pid file doesn't get cleaned up when the service is stopped and also
doesn't get cleaned up on an uninstall. Remove the pid file in the
"stop" routine.

Add a couple of helpful status messages regarding starting and looking
for the RTC.
The latest Fedora 39 doesn't load the rtc module the same way anymore.
add an ExecStartPre to handle this as required.

The i2c bus is now 3 in Fedora 39. Add a search for the right bus at
install time. Parameterize the bus number in various places and set the
value in the right files at install time.

Clean up various pre and post directive things to upgrade, install
and remove better.
Sometimes i2c buses can be enumerated with 2 digits. Support more than
one digit.
The files section of the spec file had python verison 3.12 hard coded
into the filenames. Resolve with a wildcard.
Fix python version dependency in packaging
In the latest Fedora 41 beta, the i2c bus enumeration seems to be
random. This causes the discovery at install time to fail randomly. By
migrating the install-time discovery into a script and doing it instead
at system unit start time, it seems to resolve the issue.

There seems to be support for aliases in dtb. Maybe that's a better
approach. We'll look into it. This approach seems robust since the
discovery only uses i2cget, which I think is safe.
Fix a couple of rpmbuild errors.
was adding a line to unit file. Don't do that.
dnf now requires users to be declared and managed
* we want to add our super users to the group
* I guess dnf doesn't clean up user on uninstall?
fix group mods and user clean up
If you run pijuice_gui from the command line, you need access to the
state folder.
fix perms for user of pijuice gui
I guess the deprecated tkinter syntax for trace and caught up with us.
There was a deprecation working in the cli script. Let's just
fix that now since it will be bite us eventually
The wrapper requires that the script be owned by the power user. This
used to be pijuice but then we'd have to sudo. Since we need to fix
this for the gui, let's unify it around the power user.
The cli script needs to be owned by power user
* change file permissions. I'm not 100% sure why they have
  the tray and gui run as pijuice. But latest gnome doesn't
  seem to support that or I can't figure out how to hack
  the security. Install and run as the power user which
  means no one else can run it. Good enough
* change tray app to use gtk4. there is no systray anymore
  so this first pass opens it as a little window which is kind
  of annoying. It seems GNotification is the class to use so
  we'll look into that and add in a later release.
- rename gnome app files to use reverse domain notation
- don't autostart the python tray app anymore
- finally update comments
- --about pops up the GUI about box and then closes
- --battery_status writes some status to stdout that the gnome quick
  settings can process
slow down the refresh to every 10 seconds
This is a headache. gnome requires us to say which version it works in
so needs to be bumped every time. Let's add 51 for good measure. I might
not be using this device for much longer.
Gnome version needs to be declared
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant