Help needed for Python-SMBus and I2C-tools

edited March 19 in Projects

Hi Emteria-Team and everybody else,

firstly I'll introduce what's planned with Emteria.OS.
I want to integrate a Raspberry based headunit running Emteria in my car, therefor I do evaluate your OS since a Month. The most things I need to run are working very well. Now there is the ultimate Showstopper. I bought a UPS from the german Company Olmatic called S.USV advanced. It's designed to work perfectly with the Raspberry but to control and configure the behavior of the unit (its also a VRM, so it regulates the 12V Boardvoltage down to whats needed on the Pi and HATS and RTC is integrated too) there is the installation of the two tools necessary. On their manual they point out howto do it on raspbian. Is there a way to get these packages into and upto running on Emteria?

I'm looking forward to hearing from you with a positiv feedback ;-)
If this works I'm going to buy a business license.

Tagged:

Comments

  • I2C tools is already included into emteria.OS. There are also packages for Android, but I never installed it myself. Maybe something like Termux will help you.

  • Hi kalkov, this is exactly what i did yesterday. xD But I didnt find Python-SMBus in the Pkg installer search.> @kalkov said:

    I2C tools is already included into emteria.OS. There are also packages for Android, but I never installed it myself. Maybe something like Termux will help you.

    Hi kalkov,

    thank you for your fast response. How can I use I2C tools within emteria? Is it only possible via SSH? Because Termux said command not found when I type i2cdetect -y -1. I also have to install the client on the OS, but i think it isnt possible with Termux causing forbidden writing permissions.

    Best regards, Kevin.

  • Well, obviously I can't provide you a tutorial for using termux - feel free to search the Internet. I2C should work with any shell (if it was initialized properly) like SSH, ADB, UART console or others:

    rpi3:/ $ i2cdetect -y 1
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --
    rpi3:/ $
    
  • @kalkov said:
    Well, obviously I can't provide you a tutorial for using termux - feel free to search the Internet. I2C should work with any shell (if it was initialized properly) like SSH, ADB, UART console or others:

    rpi3:/ $ i2cdetect -y 1
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
    00:          -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --
    rpi3:/ $
    

    Hi Kalkov,

    many thanks. Wasn't meant in this way (tutorial). Asked only for the permissions to write in Emteria. I'll give it a try and report my results in the next days. Thank you again for your quick response :smiley:

  • Hi Kalkov,

    hope you're doing good.

    After i tried some commands in the ssh client, only things like "ls", "cd" and "chmod" seem to be followed. Is there a list or command for a list wich shell commands are working on Emteria?

    Anyway Termux seems to be won't install the deamon of the ups because of design differences to a normal linux. I'll have a look an the add-On AnLinux and will report.

    Is there the possibility that you or one of you could integrate the ups deamon in the Linux-subsystem or is it impossibible due to the design of Emteria.OS?

    Best regards, Kevin.

  • Android uses toybox for shell (http://landley.net/toybox/about.html).
    What is UPS deamon? You can cross-compile your software and run it in Android as usual.

  • the ups deamon is the client software (systemd pkg) for the uninterrupted power suply HAT from this Olmatic company. It seems to be written in python, think thats why the requirement ist the python-smbus pkg and the i2c-tools pkg is just for checking the adress and if the eeprom is read correctly. It controls the the HAT and with this client it is possible to power of the raspi completly if extern power fails (with file safe shutdown on battery) or time based start/shutdown and also writes the correct time from the RTC at the boot back to the OS. Tried it out on raspbian. I'll have a look on Toybox and cross-comiling.

    Thanks again.

  • Hi kalkov, hi at everyone else in the thread.

    Thought you would like to here that I did some progress one the problem.

    Firstly, to compile the clientapp or crosscompile it from raspbian to android wont clear the request for two reasons.
    One is that the client neccessarily need the python-smbus pkg which i think isnt available for android. Second and also simple is the fact that I dont own the sourcecode of it because its written by Olmatic GmbH itself and the shutdown commands wouldnt work because android isnt debian or raspbian. Which leads me to another problem.

    But next I've to tell some good news.

    Based on sven-olas debian-kit (available on f-droid) I was able to install debian jessie side-by-sido to emteria based on the kernel. I was also able to update and upgrade the distro after having some trouble with i think non probably mounted directorys where some commands helped me to fix for the moment (mount -o remount,ro /sys/fs/selinux and mount -o remount,rw /sys/fs/selinux).

    After this step i was also able to install i2c-tools and the needed python-smbus packages into debian and to install the client too.

    So far... the client also works and after i did some search in the emteria-forum and made some changes based on timezone in debian i was also able to wrote the actual time into the rtc which is a ds1307 as seen in this threads wich helped me alot (as mentioned above)

    https://forum.emteria.com/discussion/comment/2664#Comment_2664
    https://forum.emteria.com/discussion/522/enable-i2c-and-install-a-rtc/p1?new=1

    Now I've two major issues left and some little ones which aren't the case at the moment.

    First major issue is when emteria gets the shutdown command from the shutdown app included in the system it seems emteria isn't completly shutdown. Because after switching the psu off, the pi is sucking the ups's (and thats also the rtcs) battery emtpy and then turns off completly. The correct behavior based on my experience in raspbian with the clientapp for the ups is, that the client gets the shutdown command to and after shutting down the os cutting down the power until you hit the powerbutton (integrated) or if it was a powerfail shutdown cutting down the power until (psu) is restored.

    Second major issue based on the first one is, when it comes to a powerfail shutdown the client tries to shutdown or maybe shutdown the debian running sidy-by but only one thing in emteria happens, the message that my power is insufficient. And i think the problem is here different commands to the kernel for shutting down the OS.

    Which leads me at last to my question for kalkov. Is there a way to send commands from the debian to the android side without ssh or anything else? i can complet handle both sides on the shell with connectBot app which is also available on f-droid.

    Best Regards Kevin.

  • @rooky said:
    Is there a way to send commands from the debian to the android side without ssh or anything else? i can complet handle both sides on the shell with connectBot app which is also available on f-droid.

    Glad to hear you are making progress. Unfortunately, I don't understand your question. I don't know how Debian and Android work together in such configuration.

  • Hi kalkov,

    as far as I understand what sven ola was doing, is to install the needed repositorys and files to run the debian parallel to android on the kernel. A hint wich leads me to this conclusion is, when i changed the microSDCard from pi 3B (pi 3B is equiped with the UPS HAT and planned for car integration) to the pi 3B+ (which is actual in the car for testing apps like navigation and dab+).

    The 3B+ runs only on the cigarette lighter plug in the car and shows now, after installing debian side-by the uniffecient power symbol which is known from raspbian.

Sign In or Register to comment.