Closed IAmNickNack closed 11 months ago
Hi @IAmNickNack The code looks quite ok. Did you test it on a normal I2C connection as well?
Could you clarify normal I2C
?
If you mean I2C via non-socket GPIO, then no. Even prior to making this change I have been unable to get non-socket GPIO working on my local setup. Startup fails on my v4 device with PIGPIO ERROR: PI_INIT_FAILED
. I have resorted to either GPIO over sockets or Linuxfs providers.
If this is what you mean. I can persevere.
Hi @IAmNickNack the PI_INIT_FAILED error you get is most probably because you are not running it as root. Can you try again with root?
Hi @IAmNickNack the PI_INIT_FAILED error you get is most probably because you are not running it as root. Can you try again with root?
Running as root appears to make no difference. I will have to try a simpler test case than the application I'm currently working on to see if I can find out what's going on.
Filesystem permissions appear to be correct. I would expect both root and the user account to behave the same in this case anyway:
crw-rw---- 1 root gpio 245, 0 Oct 23 11:17 /dev/gpiomem
Hi @IAmNickNack the PI_INIT_FAILED error you get is most probably because you are not running it as root. Can you try again with root?
A-ha! This could be useful information to others, as I've seen this error mentioned in a number of posts:
Non-socket GPIO doesn't work when pigpiod
is running! In my case it runs as a service to support development from a laptop. pigpiod
presumably has some lock on /dev/gpiomem
(?) 🤷
I did still need to be running as root for this to work though.
So, in response to your original question @eitch, yes. I have tested this code change with a normal, non-socket i2c connection and have satisfied myself that it is good.
Please feel free to suggest a more rigorous and definitive testing strategy to me if you like however.
Thanks
Hi @IAmNickNack thanks for your work! I have merged your PR. Happy to see it works!
Thanks @eitch. Hopefully somebody with an active serial or SPI project can add appropriate support for the equivalent operations to the switch
as necessary.
This PR addresses issue #303 and could possibly be expanded to cover SPI and serial data too.