g4klx / MMDVMHost

The host program for the MMDVM
GNU General Public License v2.0
378 stars 275 forks source link

OLED over I2C requires root... #207

Closed AndyTaylorTweet closed 7 years ago

AndyTaylorTweet commented 8 years ago

Using an OLED Screen (Generic SSD 1306 / 128x64) seems to require a lot of permissions. I tried adding the mmdvm user to both the "spi" and "i2c" groups, but when running the example code for the OLED as the mmdvm user I still fail (requiring access to "kmem").

Since that means (so far as I can see) no way to use the screen without being root; I solved my own issue by modifying MMDVMHost.cpp line 194 from: #if !defined(HD44780) to #if !defined(HD44780) && !defined(OLED)

  1. Anyone else having this issue?
  2. Any better thoughts about how to over-come it, rather than retaining root privs ?
phl0 commented 8 years ago

Maybe @iball can say something?

AndyTaylorTweet commented 7 years ago

Should I write this up as a pull request - or do we want to wait for more input?

iball commented 7 years ago

@phl0 You rang? Heh. :-)

Honestly I tried using an SSD1306 OLED display once, but I couldn't get the Pi 2 to recognize it on the GPIO pins (DVMega was on a USB port at the time to keep it out of the way during testing). And without the Pi recognizing it as a device, MMDVMHost certainly couldn't use it.

To be honest I didn't spend much time trying it, it was more of a "I was Bored" brain exercise. I have been able to get Nextion, Adafruit I2C 2x16 LCD, and LCDproc displays working on the Pi. Couldn't get LCDproc working with MMDVMHost running on a Windows 10 PC though, with the LCDd being on a PI with a 2x16 display hooked up to it via USB. Works just fine with MMDVMHost on a Pi and LCDd on another Pi across the room with everything working entirely over wireless.

Lately I've been looking at getting TFT displays working on the GPIO and displaying MMDVMHost info on them but haven't even started on it yet past the "getting the standard Linux console on it" stage.
Maybe it would be easier for folks to look into an MMDVMHost real-time status API now? Parsing log files for a web interface is one thing, but it is kind of laggy. This way someone could use any screen they want on any device they want, they just need to whip something up in the language of their choice (I like python) that would pull the data from the API and put it on the screen. OpenSPOT has a decent near real-time status API provided you don't poll it too fast.

Just my random thoughts.

AndyTaylorTweet commented 7 years ago

I'm using the SSD1306, soldered to +5v (GPIO2), Ground (GPIO6) and i2c (GPIO3 and GPIO5), I'm using a DVMega hat on the Pi, with the above pins soldered onto the pads on the top of the DV-Mega.

It all works just like it should, be warned that since this is an i2c device, it does not show up in /dev, but the code in MMDVMHost drives the screen just fine, with the only caveat being that so far as I can tell it requires a load of permissions to do so.

Once I modified MMDVMhost to not drop root privs, I didn't have any more issues (without doing this the screen is non operational).

The example code for the screen also required root privs - so I don't believe that this is an issue with MMDVMhost but rather the way that i2c is driven.

g4klx commented 7 years ago

I modified the MMDVM Host to not drop privileges for OLED in daemon mode. It's in GitHub now.