User Tools

Site Tools


pinephone

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
pinephone [2020/06/24 09:39] – [Current State] markpinephone [2020/07/21 12:02] (current) mark
Line 56: Line 56:
  
  
 +===== Changelog =====
  
-==== Kernel ====+There is no official changelog, 
 + 
 +https://www.retallack.org.uk/pinephonechangelog.html 
 + 
 + 
 +===== Kernel =====
  
 The kernel currently used is: The kernel currently used is:
Line 88: Line 94:
  
  
-==== Crust ====+===== Crust =====
  
 The Pinephone uses CRUST to do the power management.  The Pinephone uses CRUST to do the power management. 
Line 96: Line 102:
  
  
-==== Current State ====+===== Current State =====
  
 The following is not working: The following is not working:
Line 108: Line 114:
  
  
-=== Vibration motor ===+==== Vibration motor ====
  
 From https://xnux.eu/devices/feature/vibrator.html#toc-example-program-to-control-the-vibration-motor there is a test app (assuming its using the force feedback input). From https://xnux.eu/devices/feature/vibrator.html#toc-example-program-to-control-the-vibration-motor there is a test app (assuming its using the force feedback input).
Line 143: Line 149:
  
  
-=== Camera ===+==== Camera =====
  
-The camera is a OV6540 and is connected via the sun6i csi interface. +The camera is a OV6540 and is connected via the sun6i csi interface. This is how to enable it 
  
-The PostmarketOS kernel (Pulled in APKBUILD from https://gitlab.com/postmarketOS/pmaports/-/tree/master/main/linux-postmarketos-allwinner ) pulls in https://gitlab.com/pine64-org/linux/-/tree/2a6074e53b019db8a4a63cb255bc29422db3fe19 
  
-When this is compared to the current ubtouch kernel there are few changes to the DTS files, and the sunxi usb module. However the bug difference is the kernel config files. They are very different. +So First we need to enable number of modules in the kernel tree
  
 +<code>
 +CONFIG_V4L2_FLASH_LED_CLASS=m
 +CONFIG_LEDS_CLASS_FLASH=m
 +CONFIG_LEDS_BRIGHTNESS_HW_CHANGED=y
 +CONFIG_LEDS_SGM3140=m
 +</code>
  
-The first is that CONFIG_VIDEO_DEV is build into the kernel, while ut is a moduleThis also includes CONFIG_VIDEO_V4L2And CONFIG_V4L2_MEM2MEM_DEV=y for the pmos+Then compile up the kernel modulesthis generates three new modules led-class-flash.ko, v4l2-flash-led-class.ko, leds-sgm3140.ko.
  
-The following is also set on the pmos:+Copy these over the PinePhone and install them into the running kernel:
  
 <code> <code>
-CONFIG_STAGING_MEDIA=y +sudo insmod led-class-flash.ko 
-CONFIG_VIDEO_SUNXI=y +sudo insmod v4l2-flash-led-class.ko 
-CONFIG_VIDEO_SUNXI_CEDRUS=y+sudo insmod leds-sgm3140.ko
 </code> </code>
  
-None of these are set on the ut kernel.+You should now have the /dev/media1 device
  
-CONFIG_MEDIA_SUPPORT is also set to a module on utit exists, but does not load(does not fail to load)May be a dummy module?+NextUT does not have media-ctl, we could use the apt version, however that one is too old. Instead I used: https://archlinuxarm.org/packages/aarch64/v4l-utils
  
-Interestingly, CONFIG_VIDEO_SUN4I_CSI is not set in pmos, but is set to module in ut+Download this package and copy just the media-ctl over to the PinePhoneThen setup the media device:
  
-Strangely, if we extract config.gz from the phone, its different to the one used in the kernel!!!!+<code> 
 +sudo ./media-ctl -d /dev/media1 --set-v4l2 '"ov5640 3-004c":0[fmt:UYVY8_2X8/1280x720]' 
 +</code>
  
 +Now we need to check that it all works
  
-The actual config file is a lot closer to the pmos oneAnd nothing seems to suggest a major difference.+Ok, by using fswebcam, we can install this from apt (Note this may be unsafe and could brick the PinePhone......) 
  
-OPPS wrong kernel branch!!!!! try again....+<code> 
 +sudo mount /dev/loop0 / -o remount,rw 
 +sudo apt-get install fswebcam 
 +sudo mount /dev/loop0 / -o remount,ro 
 +</code>
  
- +And now we are ready to capture:
-On ut:+
  
 <code> <code>
-i2c@1c2ac00: +fswebcam --device /dev/video1 --resolution 1280x720  -p UYVY --verbose --save bob.jpeg 
-#address-cells  clocks  compatible  interrupts  name  pinctrl-0  pinctrl-names  reg  resets  #size-cells  status  touchscreen@5d+</code>
  
-i2c@1c2b000: +Using gstreamer, the orientation is wrong. 
-#address-cells  clocks  compatible  interrupts  lis3mdl@1e  mpu6050@68  name  pinctrl-0  pinctrl-names  reg  resets  #size-cells  status  stk3311@48+
  
-i2c@1c2b400: +V4l2Src should implement GstVideoOrientation see https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good/html/gst-plugins-good-plugins-v4l2src.html
-#address-cells  clocks  compatible  interrupts  name  pinctrl-0  pinctrl-names  reg  resets  #size-cells  status+
  
-i2c@1f02400: 
-#address-cells  clocks  compatible  interrupts  name  reg  resets  #size-cells  status 
-</code> 
  
-on ut:+GstVideoOrientation 
 + 
 +See 
 + 
 +https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/blob/230cf41cc966d7b3ebea248b82e1e3a60ac58d63/sys/v4l2/gstv4l2src.c#L110 
 + 
 +this is implemented in 
 + 
 +https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/blob/1.10.4/sys/v4l2/gstv4l2vidorient.c 
 + 
 + 
 +For gst-droid (used on android), https://github.com/sailfishos/gst-droid/blob/e755c8521b3ff0a622fba4c85e57ff41015c7793/gst/droidcamsrc/gstdroidcamsrc.c#L271 
 + 
 +For droidcamsrc: 
 + 
 + 
 +https://github.com/sailfishos/gst-droidcamsrc 
 + 
 + 
 +So does not look like v4l handles angle 
 + 
 + 
 + 
 +==== PinePhone Camera ====  
 + 
 +I have created a special version of the Camera app for the Pinephone, this is not the correct solution to the problem, but works for now.  
 + 
 +The following script also needs to be run once to setup the media control and video input. It assumes the the non-standard version of media-ctl is available along with the kernel modules (see above).
  
 <code> <code>
-i2c@1c2ac00: +#!/bin/bash
-#address-cells  clocks          interrupts      pinctrl-0       reg             status +
-#size-cells     compatible      name            pinctrl-names   resets          touchscreen@5d+
  
-i2c@1c2b000: +sudo insmod led-class-flash.ko 
-#address-cells  clocks          interrupts      mpu6050@68      pinctrl-0       reg             status +sudo insmod v4l2-flash-led-class.ko 
-#size-cells     compatible      lis3mdl@1e      name            pinctrl-names   resets          stk3311@48+sudo insmod leds-sgm3140.ko
  
-i2c@1c2b400: +sudo ./media-ctl -d /dev/media1 --set-v4l2 '"ov5640 3-004c":0[fmt:UYVY8_2X8/1920x1080@1/20]'
-#address-cells  clocks          interrupts      pinctrl-0       reg             status +
-#size-cells     compatible      name            pinctrl-names   resets+
  
-i2c@1f02400: +sudo v4l2-ctl --set-ctrl horizontal_flip=1 --device=/dev/video1 
-#address-cells  #size-cells     clocks          compatible      interrupts      name            reg             resets          status+sudo v4l2-ctl --set-ctrl vertical_flip=1 --device=/dev/video1
 </code> </code>
  
  
-=== Cross Compile ===+ 
 +The Custom version of the camera can be found here: {{ ::uk.co.retallack.camera-3.1.5.arm64.zip |}} 
 + 
 +And the src is: https://gitlab.com/Retallack/camera-app 
 + 
 +===== Cross Compile =====
  
 https://blog.marcg.pizza/marcg/pinephone-arm-build-environment-setup https://blog.marcg.pizza/marcg/pinephone-arm-build-environment-setup
pinephone.1592991598.txt.gz · Last modified: 2020/06/24 09:39 by mark