• Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
UBports Robot Logo UBports Forum
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  1. Home
  2. wouter182
  3. Best
W
Offline
  • Profile
  • Following 0
  • Followers 0
  • Topics 1
  • Posts 4
  • Groups 0

Posts

Recent Best Controversial
  • RE: Ubuntu Touch Q&A 79 Saturday 4th Of July At 19:00UTC

    Can we have Erfan Abdi on the show, he has done a lot of work on halium 9, generated publicity on xda. So would be interesting to know what his future plans are and what is holding us back to have a halium 9 GSI phone as a phone with the same quality as halium 7. Maybe the project board of halium 9 can be filled with the major challenges https://github.com/orgs/ubports/projects/20

    posted in News
    W
    wouter182
    1 Jul 2020, 22:45
  • Sensors for the pinephone

    Draft: Sensors for the pinephone with the sensors stk3310, mpu6050 and lis3mdl.
    Please note that not all the pinephone starting from 2021 have the lis3mdl sensor.
    This topic tries to give all the information you need if you want to work on the pinephone sensors.
    Please note that in the worst case, your pinephone could crash and you need to reinstall the os on your phone and the data will be lost. Therefore use a separate sd card for development.

    Using the sensors in combination with bash to get information:
    cat /sys/bus/iio/devices/iio\:device3/name
    This gives the result: lis3mdl
    To set the sensor properties in bash you have to be root, hence:
    sudo -i
    echo 2 > /sys/bus/iio/devices/iio\:device3/sampling_frequency
    This will set the sampling frequency to 2 Hz.

    Sensorfw is started and stopped with upstart.
    Restarting the service could be done with:
    sudo service sensorfw restart

    The log of sensorfw is given in /var/log/upstart/sensorfw.log
    To remove the log before you restart it:
    sudo rm /var/log/upstart/sensorfw.log*

    Reading the log can be done with you favorite command line reader:
    sudo cat /var/log/upstart/sensorfw.log

    Location of the sensorfw upstart file:
    /etc/init/sensorfw.conf
    To make the output more verbose, switch from --log-level=warning to --log-level=test.
    See below.

    description "Sensorfw Services"
    
    start on started dbus
    
    respawn
    
    exec /usr/sbin/sensorfwd --device-info --log-level=test --no-magnetometer-bg-calibration
    

    Location configuration file:
    /etc/deviceinfo/sensorfw/pinephone.conf
    If the configuration file is updating correctly after a change in the file is not completely known. Investigation point.

    [plugins]
    accelerometeradaptor = iiosensorsadaptor
    orientationadaptor = iiosensorsadaptor
    alsadaptor = iiosensorsadaptor
    magnetometeradaptor = iiosensorsadaptor
    gyroscopeadaptor = iiosensorsadaptor
    proximityadaptor = iiosensorsadaptor
    
    [accelerometer]
    input_match=mpu6050
    default_interval=500
    transformation_matrix = "0,1,0,-1,0,0,0,0,-1"
    
    [als]
    input_match=stk3310
    intervals = "200=>2000"
    default_interval=500
    
    [gyroscope]
    input_match=mpu6050
    default_interval=500
    transformation_matrix = "0,1,0,-1,0,0,0,0,-1"
    
    [magnetometer]
    input_match=lis3mdl
    intervals = "12.5,25,50,100,200,333.3,500,1000"
    default_interval=500
    #scale_coefficient = 1
    needs_calibration = 1
    #dataranges = "-4096=>4096"
    #interval_compensation = 16 ????
    calibration_rate = 12.5
    calibration_timeout = 60000
    
    [proximity]
    input_match=stk3310
    intervals = "200=>2000"
    default_interval=500
    threshold=19
    

    Using crossbuilder:
    clone the git repository of you project which you would like to build
    git clone https://github.com/wouter182/sensorfw.git
    Go into the project directory
    cd sensorfw

    Edited:
    Build the package
    crossbuilder --architecture=arm64 build
    Create the deb package and deploy it on the pinephone
    crossbuilder --architecture=arm64 --ssh=<Your IP> deploy
    Please make sure that you prevent the automatic lock of the home screen. This prevents the phone going into sleep. If the phone is in sleep mode, the wifi connection is not stable anymore (this to reduce energy consumption).

    Restart sensorfw or reboot the phone and check your work (not completely sure if this works correct with loading of the sensorfw config file)

    For building the SensorStatus app:
    Clone the sensorstatus repo from wouter182.
    git clone https://gitlab.com/wouter182/SensorsStatus.git
    Go inside the sensorstatus folder
    cd SensorsStatus
    and run clickable --ssh <Your IP>, this will generate the app in click format and will start it automatically.
    With clickable log --ssh <Your IP> you can check the log files from the app. In case of a crash or to check for errors.

    Setting up ssh on the pinephone:
    https://docs.ubports.com/en/latest/userguide/advanceduse/ssh.html

    Setting up crossbuilder:
    Download the crossbuilder script:
    git clone https://github.com/wouter182/crossbuilder
    For further instruction see https://docs.ubports.com/en/latest/systemdev/testing-locally.html

    Read only rootfs:
    Use sudo mount / -o remount,rw to make the rootfs temporary read and writable.
    Note that after an system upgrade, the changed files will be overwritten.

    Testing a merge request:
    Testing a merge request can be done with ubports-qa, see https://docs.ubports.com/en/latest/systemdev/uploading-changes.html

    Setting up clickable:
    See https://clickable-ut.dev/en/latest/install.html

    Links with the information you probably need.
    Crossbuilder in combination with ssh and automatic delploy:
    https://github.com/ubports/crossbuilder/pull/53
    Sensorfw for the pinephone:
    https://github.com/ubports/sensorfw/tree/xenial_-_edge
    https://github.com/ubports/sensorfw/pull/4
    Please take note that the pinpehone uses the xenial_-_edge repository at the moment.
    See https://gitlab.com/ubports/core/rootfs-builder-debos/-/blob/master/scripts/add-mainline-repos.sh#L23

    Configuration file for sensorfw from deviceinfo:
    https://gitlab.com/ubports/core/deviceinfo/-/blob/main/configs/sensorfw/pinephone.conf

    Sensorfw plugin in Qt:
    https://code.qt.io/cgit/qt/qtsensors.git/tree/src/plugins/sensors/sensorfw?h=5.12

    SensorStatus app:
    https://gitlab.com/wouter182/SensorsStatus
    SensorStatus app in the open store:
    https://gitlab.com/balcy/SensorsStatus

    Background information:
    Information about the iio (industrial input and output) sensors in combination with linux:
    https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-iio
    Magnetometer driver in linux for reference:
    https://gitlab.com/pine64-org/linux/-/tree/pine64-kernel-ubports-5.10.y-megi/drivers/iio/magnetometer
    Upstream sensorfw if you liked the gitlab search function like me:
    https://git.sailfishos.org/mer-core/sensorfw
    https://github.com/sailfishos/sensorfw
    QML information for sensors:
    https://doc.qt.io/qt-5.12/qtsensors-index.html

    To be continued...

    posted in PinePhone
    W
    wouter182
    27 Jun 2021, 13:35
  • RE: Sensors for the pinephone

    Hi @applee
    The deb packages are the recommended way for the middleware. Sensorfw is the software which connects the linux drivers of the sensors to Qt and does the calibration.
    In this way all apps which use Qt could make use of the sensors.
    For the SensorsStatus app clickable is the way to go.

    posted in PinePhone
    W
    wouter182
    29 Jun 2021, 20:51