linux-on-hi10 icon indicating copy to clipboard operation
linux-on-hi10 copied to clipboard

Bluetooth, light sensor and accelerometer

Open willyneutron opened this issue 6 years ago • 10 comments

Hi guys,

First of all, thank you all for your awesome work. I have been working on a guide of how to install Lubuntu in the Chuwi and I have encountered some information that may be useful for ArchLinux.

Bluetooth adapter works after installing Larry Finger's drivers:

cd /tmp
git clone https://github.com/lwfinger/rtl8723bs_bt
cd rtl8723bs_bt
make
sudo make install

Every time you need to activate bluetooth, a script must be run, so I think is a good idea to set a root cron job to do so at startup.

Create a new directory, copy contents in it:

sudo mkdir /opt/rtl8723bs/
sudo cp * /opt/rtl8723bs/
sudo crontab -e

Then write the cron job:

@reboot cd /opt/rtl8723bs/ && ./start_bt.sh 

Regarding the light sensor, if anyone is interested in reading information from it, I made it work by installing more drivers (found in a Nextbook Flexx 10 guide):

cd /tmp
git clone https://github.com/burzumishi/linux-baytrail-flexx10/ -b Readme-stage --single-branch
cd linux-baytrail-flexx10/kernel/modules/cm3218_light_sensor
make
sudo make install
sudo modprobe cm3218

Once installed, you can read sensor value like this:

sudo cat /sys/bus/iio/devices/iio\:device1/in_illuminance0_input

I have also being working on a way to automatically rotate the screen based on accelerometer information (repo here), but it is not working fine with the touchscreen.

I hope this helps

willyneutron avatar Apr 17 '18 19:04 willyneutron

Amazing!

I didn't have a clue about the actual chips for those sensors :laughing:

I will take a look in the following days and post an update here.

Thanks!

danielotero avatar Apr 20 '18 19:04 danielotero

For the input issues, every time a display is (dis)connected or the display is rotated, try running:

xinput --map-to-output silead_ts DSI1

This is assuming that it was calibrated with the left side up (the windows button on the bottom). (Using xinput_calibrator to flip the screen is not the right solution.)

samueldr avatar Apr 20 '18 19:04 samueldr

Wow, this is a very simple solution.

Yesterday I updated my autorotator repo, now also performs the rotation of the touchscreen, but this solution is much more elegant.

I will check it.

willyneutron avatar Apr 20 '18 20:04 willyneutron

The accelerometer seems to work just fine, but I don't get any reading from the cm3218 driver, only zero values.

danielotero avatar Apr 22 '18 11:04 danielotero

Maybe the sensor is not detected properly. According to this datasheet and the driver, the sensor only could be located in either address 0x10 or 0x48 inside i2c bus.

I have listed my I2C buses and obtained this:

sudo i2cdetect -l
i2c-3    i2c           Synopsys DesignWare I2C adapter     I2C adapter
i2c-13    i2c           DPDDC-B                             I2C adapter
i2c-1    i2c           Synopsys DesignWare I2C adapter     I2C adapter
i2c-11    i2c           i915 gmbus dpb                      I2C adapter
i2c-8    i2c           i915 gmbus vga                      I2C adapter
i2c-6    i2c           Synopsys DesignWare I2C adapter     I2C adapter
i2c-4    i2c           Synopsys DesignWare I2C adapter     I2C adapter
i2c-14    i2c           DPDDC-D                             I2C adapter
i2c-2    i2c           Synopsys DesignWare I2C adapter     I2C adapter
i2c-12    i2c           i915 gmbus dpd                      I2C adapter
i2c-0    i2c           Synopsys DesignWare I2C adapter     I2C adapter
i2c-9    i2c           i915 gmbus panel                    I2C adapter
i2c-10    i2c           i915 gmbus dpc                      I2C adapter
i2c-7    i2c           i915 gmbus ssc                      I2C adapter
i2c-5    i2c           Synopsys DesignWare I2C adapter     I2C adapter

I have also scanned all of them and I think the chip is located in i2c-2, on 0x10:

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

As it seems to be located in a "Synopsys DesignWare I2C adapter", so maybe it has something to do with kernel configuration. I am using 4.13.0-25-generic from Ubuntu repos.

My target configuration was:

CONFIG_PWM=y
CONFIG_PWM_CRC=y
CONFIG_I2C_DESIGNWARE_PLATFORM=y
CONFIG_I2C_DESIGNWARE_PCI=y
CONFIG_INTEL_SOC_PMIC=y
CONFIG_DRM_I915=m
CONFIG_PWM_LPSS=y
CONFIG_PWM_LPSS_PCI=y
CONFIG_PWM_LPSS_PLATFORM=y
CONFIG_X86_INTEL_LPSS=y

Finally, in the kernel I was using, some of these configurations were already fine, so I only needed to change:

CONFIG_I2C_DESIGNWARE_PCI=y
CONFIG_PWM_LPSS=y
CONFIG_PWM_LPSS_PCI=y
CONFIG_PWM_LPSS_PLATFORM=y

I think that I tested the sensor prior to do changes to the kernel, so maybe the culprit is one of the first configurations.

Hope it helps

willyneutron avatar Apr 25 '18 21:04 willyneutron

As for right now, on my Hi10 Plus, Bluetooth is working out of the box.

Danct12 avatar Apr 18 '19 01:04 Danct12

Anyway, accelerometer still doesn't work for me in 5.1 kernel. Still reporting invalid chip for me.

Danct12 avatar May 19 '19 01:05 Danct12

Hello, I don´t know if this project is still followed, but as I have a chuwi hi 10 pro and it was kind of slow with windows I have tried to install linux on it. I have followed this repo to see the progress and was not convinced until recently when I stumbled upon this https://forum.xda-developers.com/general/general/chuwi-hi10-air-linux-installation-guide-t3915804 I chose Antergos with XFCE and pretty much everything was working out of the box, except touchscreen and rotation. After some diggin I found working solutions for each and thought that may be worth it to post them here in case anyone ends up here too.

Rotation: There is a tablet section in the Arch wiki that has different aproaches to this problem https://wiki.archlinux.org/index.php/Tablet_PC#Automatic_rotation. The one that worked for me (after login) was this one https://github.com/GuLinux/screenrotator

Touchscreen: I used silead_ts firmware following the instructions on this page, it is a bit off but functional. Also found this post on how to properly calibrate it https://forum.manjaro.org/t/touchscreen-chuwi-hi10-pro-working-but-needs-calibration/51363/5 but I haven't tried it yet and is for de gslx driver so I don't know if the numbers will work, I will try it later and report the results.

I hope all the information I have provided is acurate and works, if someone finds any errors or better ways please feel free to correct or improve my comments.

Thank you all for making linux posible in this tablet.

ghost avatar May 23 '19 09:05 ghost

As an update on the touchscreen, the method that worked best for me is the one described in this repo, although I had to adjust the 50-touchscreen.rules a little to correct the offset. Regarding touchscreen functionality there is a project called touchegg that seems interesting https://wiki.archlinux.org/index.php/Touchegg

ghost avatar May 24 '19 07:05 ghost

Sorry about the late response! I'm not using the tablet that much lately, so I kind of halted polishing the minor things that still don't work quite right on Linux. But your comments here encourage me too keep posting some more information here.

About the rotation part: I manage to enable the screen rotation after I discovered the iio-sensor-proxy project. As I use Sway, I just adapted the monitor-sensor program to execute sway commands to rotate the screen. It works pretty well!

I'm currently working with the touchscreen kernel driver so the calibration won't be necessary, and also enabling the touch screen button!

danielotero avatar May 25 '19 20:05 danielotero