Symbiosis: Source code and documentation

Yes.

Changelog: 
1.0.32 Adds i2c support to control TOH

There’s an example how to use it in the community library of user claudeshannon.

1 Like

Maybe one could set the permissions for the I2C interface differently and/or add the user to a certain group? I haven’t tried that yet.

1 Like

Yea some udev magic should be able to chgrp/chmod the device accordingly.

Maybe use the sailfish-system group? Or invent a new one sailfish-toh which only the “device owner” has.

i2c-tools does something like:

KERNEL=="i2c-[0-9]*", GROUP="i2c", MODE="0660"

An example for the FP2026 is already in /lib/udev/rules.d/998-leds-jp2601.rules.

2 Likes

Or maybe install symbiosis, create a config file and ask the bus file descriptor from org.sailfishos.tohd1 on D-Bus in your application? :slightly_smiling_face:

Quite a bit of explanation of that already here. The configuration needs just tell a binary path to have access to i2c-dev like in blinker.yaml. Configurations are placed into per TOH directories like here.

Of course this wouldn’t work quite so easily for a Python script, but I suspect most would want to use something compiled. (And I’ve even compiled Python scripts into binaries for fun in the past.) Let’s see if we need to consider that too.

2 Likes

@tomin: Sorry if my questions are maybe obvious, but I’m already thinking of my own possible use cases and how I can realise them without much programming effort.

If I ever create TOHs for myself, they will likely be very simple ones. For example, a TOH with an environmental sensor IC which gives me temperature, humidity and atmospheric pressure readings. Most of these ICs don’t require complex communication protocols or strict bus timings. You basically just read and write registers whenever you want without having to develop a driver or kernel module first. The datasheet of the respective IC usually contains every information you need (register map). So I wonder:

  1. Will there be some command (or Unix file structure) in the future, which can be directly used in shell scripts and piped together with other shell commands? Something you can easily tell “Read register 0x… from target device 0x…”, or “write byte 0x… to register 0x… of target device 0x…“?
  2. Will there be commands that let me easily obtain the identification information in the TOHs base EEPROM from a shell script, to check if the correct TOH has been attached before proceeding with further communication from the same shell script?
  3. Will it be possible to programmatically switch on and off the power supply to the TOH from a shell script? The TOH attachment/detachment detection and identification routines of the OS shall not be affected of course.

The Python script from the Inari Blue thread [Proposal] Inari Blue TOH LED for notifications - #17 by cypherpunks does exactly that, it just reads and writes some registers.
It would be easy to adapt it to write anything you want.

As an alternative Automagic can directly write to registers on the TOH.

3 Likes

Thanks for the hint! I don’t have my new Jolla Phone yet, but it seems my brain is already in nerd mode. :nerd_face:

2 Likes

I crated a pull request to add the documentation: Add documentation for D-Bus and config by Tomin1 · Pull Request #5 · sailfishos/symbiosis · GitHub.

7 Likes