I2c and argonone case issues

They push a revert commit : Revert "ARM: dts: bcm2711: Add the BSC interrupt controller" · raspberrypi/linux@7f465f8 · GitHub

Could you please compile a new kernel with it please ?

Édit : I didn’t watch carrefully the kernel version but they didn’t move to 5.10.16 :unamused: maybe you want to wait for it or the new 5.11 (I hope they report this revert commit to it) ?

Both kernels just upgraded so compiling…

The 2 kernels are being push. I looked at the 5.11.0 kernel and it seems they added what was reverted in the 5.10.16 kernel so I have no clue what is up with that. They do a rebase every time the wind blows so the date may be skewed and they have not gotten around to reverting it.

Read this post before upgrading. Lots of things has changed.

https://forum.manjaro.org/t/new-raspberry-pi-kernels-related-packages/4721/376

I’ve upgraded to 5.11 and i2c-1 is not present with kms… so maybe we should comment the 5.10.14 issue to add that 5.11 is also broken to force a full rebase ?

BTW, I didn’t understand the ttymA0 switch to serial0 in /boot/cmdline.txt to avoid patchram 100% cpu bug. I guess that everyone will have it with new kernels (>= 5.10.14) but you still provide a /boot/cmdline.txt with ttymA0… Am I wrong ?

I really do not completely understand their answer either. They said the use of AMA0 in cmdline.txt was obsolete and removed the code allowing it. I looked in the Pi OS image and they also use serial0 in their cmdline.txt. It is supposed to be some sort of alias in their code now as I understand it that makes checks and switches terminals if depending on what is in use. In our case it still uses /dev/AMA0. There is no physical /dev/serial0.

This coding change does not seem to be in the kernel it’s self but in the raspberrypi-bootloader files starting with the date 20210208.

To get the argonone software to work, I had to install the the latest code for python-raspberry-gpio. The current package does not work due to the changes in Python 3.9 and gcc 10.

This is my pkgbuild:

# Maintainer: Devaev Maxim <mdevaev@gmail.com>
# Contributor: Michael Serpieri <contact at pygoscelis dot org>


pkgname=python-raspberry-gpio
pkgver=0.7.0.1a3
pkgrel=1
pkgdesc="Python library for GPIO access on a Raspberry Pi"
url="http://sourceforge.net/projects/raspberry-gpio-python"
license=(MIT)
arch=(armv6h armv7h aarch64)
depends=(python)
makedepends=(gcc python-distribute)
source=('raspberry-gpio-python-code-21bc345134c39ea0bad99eb51fc423a646a460a4.zip')
md5sums=('SKIP')

package() {
        cd "$srcdir/raspberry-gpio-python-code-21bc345134c39ea0bad99eb51fc423a646a460a4"
        python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
}

Edit: The kernel issue with /dev/i2c-1 needs to be addressed before this pkgbuild can help.

I did rebuild my own GPIO “python-raspberry-gpio” some times ago because of the RAM recognition
lack :

PKGBUILD

# Maintainer: Devaev Maxim mdevaev@gmail.com
# Contributor: Michael Serpieri

pkgname=python-raspberry-gpio
pkgver=0.7.1a3
pkgrel=1
pkgdesc=“Python library for GPIO access on a Raspberry Pi”
url=“http://sourceforge.net/projects/raspberry-gpio-python
license=(MIT)
arch=(armv6h armv7h aarch64)
depends=(python)
makedepends=(gcc python-distribute)
source=(“https://files.pythonhosted.org/packages/source/R/RPi.GPIO/RPi.GPIO-$pkgver.tar.gz” “package.patch”)
sha1sums=(‘286e062411a857be27ba056d19fca761a4e3ba31’ ‘5279644675e2211ed6364ca597e330cfc9886fec’)
prepare() {
cd “$srcdir/RPi.GPIO-$pkgver”
patch --forward --strip=1 --input="${srcdir}/package.patch"
}
package() {
cd “$srcdir/RPi.GPIO-$pkgver”
python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1
}

PATCH (package.patch)

diff --unified --recursive --text ref/RPi.GPIO.egg-info/SOURCES.txt RPi.GPIO-0.7.1a3/RPi.GPIO.egg-info/SOURCES.txt
— ref/RPi.GPIO.egg-info/SOURCES.txt 2021-01-21 19:29:51.000000000 +0100
+++ RPi.GPIO-0.7.1a3/RPi.GPIO.egg-info/SOURCES.txt 2021-01-31 21:45:03.259579856 +0100
@@ -4,6 +4,7 @@
MANIFEST.in
README.txt
create_gpio_user_permissions.py
+setup.cfg
setup.py
RPi/init.py
RPi.GPIO.egg-info/PKG-INFO
Only in RPi.GPIO-0.7.1a3: build
diff --unified --recursive --text ref/source/cpuinfo.c RPi.GPIO-0.7.1a3/source/cpuinfo.c
— ref/source/cpuinfo.c 2021-01-21 18:46:33.000000000 +0100
+++ RPi.GPIO-0.7.1a3/source/cpuinfo.c 2021-01-31 22:23:35.039471987 +0100
@@ -125,6 +125,7 @@
case 2: info->ram = “1G”; break;
case 3: info->ram = “2G”; break;
case 4: info->ram = “4G”; break;
+ case 5: info->ram = “8G”; break;
default: info->ram = “Unknown”; break;
}
} else {

1 Like

Today I ran across this independent software project, with claims of more than the original.

Is it fine ? How did you get it ? (deb package via alien?)

I have not tried it, but it looks interesting. I am hoping it gets added to the repo. I am not so great with pkgbuilds. Hoping someone who is much better comes along and makes one. :wink:

I have built some packages today and I have no clue if it will work with out having a argonone case.

The package argon1 installed here and when I tried to enable argonone.service It could not import python-smbus module so I had to go to aur and build smbus-git but it required i2c-tools-git so I had to build it also from aur. Now I am down to it not importing “import RPi.GPIO as GPIO”. I know you have built that from git and I have other rat killing I have to do today. So try what I have so far.

I did not messed with the applet part yet but it looks like it is made for lxde and may not work universally for all DE environments as is.

Install the 3 packages in the tarball and add your self to the argonone group then enable argonone.service then reboot.

https://drive.google.com/file/d/1dFiLtOHjkXCqJQpJEbzJy1s7iYb7uezE/view?usp=sharing

1 Like

Wow, thank you very much for giving this a try.

$ /usr/bin/argononed
Traceback (most recent call last):
  File "/usr/bin/argononed", line 33, in <module>
    sys.exit(load_entry_point('argon1==0.1', 'console_scripts', 'argononed')())
  File "/usr/bin/argononed", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/lib/python3.9/site-packages/argonone/__init__.py", line 9, in <module>
    import RPi.GPIO as GPIO
ModuleNotFoundError: No module named 'RPi'

Edit: Ah, but this image does not have the new GPIO. I will switch to the correct image and try again.

That is what I get here also. I thought you had python-raspberry-gpio installed you built.

pip can install RPi.GPIO also.

On my image with the latest RPi.GPIO

$ /usr/bin/argononed
Traceback (most recent call last):
  File "/usr/bin/argononed", line 33, in <module>
    sys.exit(load_entry_point('argon1==0.1', 'console_scripts', 'argononed')())
  File "/usr/bin/argononed", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 972, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 790, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/usr/lib/python3.9/site-packages/argonone/__init__.py", line 17, in <module>
    import yaml
ModuleNotFoundError: No module named 'yaml'

I installed python-yaml-5.3.1-4 and tried it again, this time:

$ /usr/bin/argononed
INFO: Loading config file from /etc/argonone.yaml
/usr/lib/python3.9/site-packages/argonone/__init__.py:529: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  config = yaml.load(fp)
Traceback (most recent call last):
  File "/usr/bin/argononed", line 33, in <module>
    sys.exit(load_entry_point('argon1==0.1', 'console_scripts', 'argononed')())
  File "/usr/lib/python3.9/site-packages/argonone/cmdline.py", line 175, in argondaemon_main
    daemon = ArgonDaemon()
  File "/usr/lib/python3.9/site-packages/argonone/__init__.py", line 541, in __init__
    self._argon_board = ArgonOneBoard(initial_speed=0, bus_mutex=Lock())
  File "/usr/lib/python3.9/site-packages/argonone/__init__.py", line 78, in __init__
    self._bus = smbus.SMBus(_SMBUS_DEV)
PermissionError: [Errno 13] Permission denied
Exception ignored in: <function ArgonOneBoard.__del__ at 0xffffac00d0d0>
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/argonone/__init__.py", line 154, in __del__
    self.close()
  File "/usr/lib/python3.9/site-packages/argonone/__init__.py", line 151, in close
    self._bus.close()
AttributeError: 'ArgonOneBoard' object has no attribute '_bus'

So I see a permission error, what the heck…
$ sudo /usr/bin/argononed

INFO: Loading config file from /etc/argonone.yaml
/usr/lib/python3.9/site-packages/argonone/__init__.py:529: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  config = yaml.load(fp)
INFO: Daemon starting
INFO: D-Bus server initialization
INFO: Power button monitoring and control thread starting
INFO: DBG: calling .wait_for_button
INFO: Fan control and temperature monitoring thread starting
INFO: D-Bus server thread starting
INFO: DBG: button_press = None
INFO: DBG: calling .wait_for_button
INFO: DBG: button_press = None
INFO: DBG: calling .wait_for_button
INFO: DBG: button_press = None
INFO: DBG: calling .wait_for_button
INFO: DBG: button_press = None

The software appears to be happy now. I will try messing with it to see if the fan functions.

This software does seem to work, if the service is started as root. As user argonone, as defined in the service file, the above permission error. I am not sure what group grants the required permission.

I modified the argonone.service file to run as user and group of root… it runs and seems to function.

With my user account:

$ argonctl speed

40

$ argonctl temp

41.381

Great!

So making the change in the service file was the only change you made?

After compiling the argon1 git the files needed were in different places so I dissected his armv7 .deb file to see were all of the files were placed to make the PKGBUILD. All of the groups, argonoe user and permissions were set in the .deb’s posinst which I converted to arch’s .install format. So I am at a loss why the permission error unless it is in the difference with a deb’s install process as opposed to arch’s.

Is it any better than the package you were using?

No other change, other than needing to install python-yaml, probably should be a dependency.
Package does conflict with argoneone-git, both install /usr/bin/argononed

I like it, but more time to mess with it. Like adding queries to my conky script. The basic use is much nicer, with the argonctl command.

Is there a option to disable INFO?

argonone[2619]: INFO: DBG: button_press = None
argonone[2619]: INFO: DBG: calling .wait_for_button
argonone[2619]: INFO: Adjusting fan speed to 40 for temperature 40.407

journalctl gets too many info messages like these.

The code has been modified with this commit aimed directly where the error occurs with the user argonone. It would seem the issue could be related to the i2c group.

I manually applied the patch:

WARNING: i2c device not accessible. Ensure user is a member of the i2c group

I wonder if /dev/i2c-1 is owned by root:i2c on debian?

And I noticed there is a hardcoded path to /usr/bin/vcgencmd which does not exist for me, I have it in /opt/vc/bin/

Edit: I found this, so it might be that is a permission error for the device.

I created a udev rule so the /dev/i2c-1 device is created with i2c as the group and 0666 permissions. My account can now successfully run

$ i2cdetect -F 1

I think this is a step forward.

Now when I try to start the daemon as user argonone, it still fails, but now in a new location:

argonone[1451]: INFO: Loading config file from /etc/argonone.yaml
argonone[1451]: /usr/lib/python3.9/site-packages/argonone/__init__.py:537: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as>
argonone[1451]:   config = yaml.load(fp)
argonone[1451]: Traceback (most recent call last):
argonone[1451]:   File "/usr/bin/argononed", line 33, in <module>
argonone[1451]:     sys.exit(load_entry_point('argon1==0.1', 'console_scripts', 'argononed')())
argonone[1451]:   File "/usr/lib/python3.9/site-packages/argonone/cmdline.py", line 175, in argondaemon_main
argonone[1451]:     daemon = ArgonDaemon()
argonone[1451]:   File "/usr/lib/python3.9/site-packages/argonone/__init__.py", line 549, in __init__
argonone[1451]:     self._argon_board = ArgonOneBoard(initial_speed=0, bus_mutex=Lock())
argonone[1451]:   File "/usr/lib/python3.9/site-packages/argonone/__init__.py", line 94, in __init__
argonone[1451]:     GPIO.setup(_SHUTDOWN_BCM_PIN, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
argonone[1451]: RuntimeError: Not running on a RPi!

Hmm, interesting error. :slight_smile:
But now it is a gpio related issue… so now I bet I need to figure out what group gpio does on debian.
There are /dev/gpio* devices, could be a similar issue.

Edit: Yes, exactly the same issue. I created a udev rule for /dev/gpiomem so that it is owned by root:gpio and 0666 permissions. And now the daemon mostly runs as the user argonone.

$ systemctl status argonone

● argonone.service - Fan and power control for ArgonOne case
     Loaded: loaded (/usr/lib/systemd/system/argonone.service; enabled; vendor preset: disabled)
     Active: active (running) since Sun 2021-02-21 21:04:46 CST; 1s ago
   Main PID: 1333 (argononed)
      Tasks: 3 (limit: 9064)
     CGroup: /system.slice/argonone.service
             └─1333 /usr/bin/python /usr/bin/argononed

argonone[1333]: INFO: Adjusting fan speed to 70 for temperature 44.303
argonone[1333]: Traceback (most recent call last):
argonone[1333]:   File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
argonone[1333]: INFO: D-Bus server thread starting
argonone[1333]:     self.run()
argonone[1333]:   File "/usr/lib/python3.9/site-packages/argonone/__init__.py", line 290, in run
argonone[1333]:     button_press = self._argon_board.wait_for_button()
argonone[1333]:   File "/usr/lib/python3.9/site-packages/argonone/__init__.py", line 144, in wait_for_button
argonone[1333]:     if GPIO.wait_for_edge(_SHUTDOWN_BCM_PIN, GPIO.RISING, timeout=timeout) is None:
argonone[1333]: RuntimeError: Error waiting for edge

An issue with the power button to be resolved.