Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. alexvanbelle
    3. Best
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Best posts made by alexvanbelle

    • RE: RPi Gateaway: Dropping root privilege

      @rozpruwacz Sounds good.
      "When I forced the build to use gpio kernel driver all works without problem when running as non root". How have you done that?

      If you show me the right command, I could work on a patch on the configuration file and ask for a pull request 🙂

      Currently, I'm using this command for configuration

       ./configure --soc=BCM2835 --my-gateway=ethernet --my-port=5003 --my-rf24-encryption-enabled --my-rf24-channel={{ rf24_channel }}
      
      posted in Feature Requests
      alexvanbelle
      alexvanbelle
    • RE: RPi Gateaway: Dropping root privilege

      @rozpruwacz Thanks, I will try

      #ifdef LINUX_ARCH_RASPBERRYPI
      #include "RPi.h"
      #define pinMode(pin, direction) RPi.pinMode(pin, direction)
      #define digitalWrite(pin, value) RPi.digitalWrite(pin, value)
      #define digitalRead(pin) RPi.digitalRead(pin)
      #define digitalPinToInterrupt(pin) RPi.digitalPinToInterrupt(pin)
      #else
      #include "GPIO.h"
      #define pinMode(pin, direction) GPIO.pinMode(pin, direction)
      #define digitalWrite(pin, value) GPIO.digitalWrite(pin, value)
      #define digitalRead(pin) GPIO.digitalRead(pin)
      #define digitalPinToInterrupt(pin) GPIO.digitalPinToInterrupt(pin)
      #endif
      

      By reading the code, it looks like this path is only for raspberry and, if it works, I see a proper fix such as: just remove the if and do what is in GPIO whatever the platform is.

      However, I have doubts this block was added by mistake. I need to understand how automated tests would catch any side effects of this fix (regressions?). This specific code was written few years ago: therefore, maybe it was required before but is no more needed now.

      Will do that:

      • Test it on my setup (my raspberry gateway is connected with 10+ sensors (arduinos with nrf))
      • If it works end to end, I will have to understand a little bit more how automated tests are launched on mysensors code base. If it seems OK, I will submit a PR.
      posted in Feature Requests
      alexvanbelle
      alexvanbelle
    • RE: RPi Gateaway: Dropping root privilege

      Just for traces, this is the commit which seems to add this code block:
      https://github.com/mysensors/MySensors/pull/734/commits/074f016a69fd5d67e033b6473b3e39535fd9e2d5

      posted in Feature Requests
      alexvanbelle
      alexvanbelle
    • RE: RPi Gateaway: Dropping root privilege

      Ok. Good news and bad news.

      Good news:

      • Updating the library is no brainer, just copy/paste and rebuild. Signatures have not changed
      • After the build mysensors just works as before in root
      • With non root user, you don't get any segfault.

      Bad news:

      • You still get an error (SPI requires root privilege => which is better than a segfault). Actually, the library doesn't require root for GPIO but it's still required for SPI and I2C.
      • I've read the code of the library and some other blog posts on this subject and currently, using SPI and I2C without root seems not to be an option. The library is initializing itself by defining memory pointers => for SPI and I2C, it's undefined and there's no clear approach to set them (root and non-root init is really different for GPIO)

      I still believe updating the library is good idea: cleaner error message and get some other fixes.

      I have opened a thread on the library google group to get more information on the reasons: https://groups.google.com/forum/#!topic/bcm2835/i3LvA2c38j4

      Alexandre

      posted in Feature Requests
      alexvanbelle
      alexvanbelle