How can I add new accelerometer sensor to qcom android HAL? - android

Would like to enable MPU6050 accel & gyro sensor for my Qualcomm board which is MSM8909 chipset and android version is 8.x Oreo.
I have tried the following.
Enabled the kernel driver for the sensor "drivers/input/misc/mpu6050.c" and able to detect the sensor in android kernel too.
Log:
[ 62.096904] input: MPU6050-accel as /devices/soc/78b7000.i2c/i2c-3/3-0068/input/input2
[ 62.101460] input: gyroscope as /devices/soc/78b7000.i2c/i2c-3/3-0068/input/input3
msm8909w:/ # echo 1 > /sys/class/sensors/MPU6050-accel/enable
msm8909w:/ # echo 1 > /sys/class/sensors/MPU6050-gyro/enable
msm8909w:/ # getevent
add device 1: /dev/input/event3
name: "gyroscope"
add device 2: /dev/input/event2
name: "MPU6050-accel"
msm8909w:/ # lshal debug android.hardware.sensors#2.0:ISensors/default
android.hardware.sensors#2.0:ISensors/default does not exist, or no permission to connect.
msm8909w:/ #
msm8909w:/ # lshal debug android.hardware.sensors#1.0
android.hardware.sensors#1.0/default does not exist, or no permission to connect.
Tried to run android app to list out the sensors and found nothing, but able to list out sensors if I run it on my phone.
Following HAL layer settings & android code changes done and no luck!
device/qcom/msm8909w/sensors/hals.conf
sensors.msm8909w.so
sensors.msm8909.so
sensors.default.so
sensors.ssc.so
sensors.native.so
Created build error in hardware/qcom/sensors/Accelerometer.cpp file to see whether this code is building or not, I didn't get any build errors.
Also referred to following document.
https://developer.qualcomm.com/qfile/28820/lm80-p0436-9_sensors_porting_guide.pdf
Do I need to change anything in HAL layer for my new sensor or anything missing here ?

If you are not aware. Then i want to tell you that:
Qualcomm uses ADSP as subsystem for their sensor.
ADSP images are loaded by qcom kernel driver.
ADSP code is proprietary.
ADSP and android HAL communicate through fastrpc.
Thanks 😊
May be this is useful.

Related

Getting a custom ramdisk to boot on Android

I am working on a "GNU/Linux on Android" type of project that is based on Mikael Q. Kuisma's work here .
I built a tool that downloads a toolchain, compiles the kernel, archives the custom ramdisk, and finally bundles them into a boot image.
Expected result:
Kernel boots.
Ramdisk gets loaded and /init is executed using /sbin/busybox.
Actual result:
Kernel does boot.
The kernel never seems to reach /init, and hangs without panicking.
I've tried adding calls to /sbin/busybox poweroff in the /init script to see if it was actually reaching execution, nothing changed.
I identified a few points that seemed problematic, one being this:
[ 3.880314] Warning: unable to open an initial console.
[ 3.880429] Waiting for root device ... # Might be the problem.
[ 4.882304] lct will vote for sdp current
[ 4.882437] pmi632_charger: smblib_update_usb_type: lct v02 battery charge APSD=SDP PD=0
[ 4.889933] msm-dwc3 7000000.ssusb: DWC3 exited from low power mode
[ 5.520181] of_batterydata_get_best_profile: light_4000mAh found
[ 8.760236] cfg_timer_func enter
[ 8.760267] cfg_work_routine enter
# Nothing appears after this point...
I have included the source code for my build tool with the kernel log buffer in this git repository. You can find the defconfig I used for the kernel build here.
Any help would be appreciated. :)

Android Port bootloop due to non updatable apex or boringssl checks

I am building LineageOS 18.1 for tecno kd7. I have system, system_ext, product & vendor paritions. The rom port I built is having a boot loop.
Here is the last_kmsg
What is causing the boot loop?
I am suspecting these lines
[ 1.802608] (0)[354:apexd]apexd: This device does not support updatable APEX. Exiting
[ 2.352523] (0)[1:init]reboot: Restarting system with command 'boringssl-self-check-failed'
I just need direction on what I need to what is causing the phone to bootloop
I also faced the same issue. The boringssl-self-test binary is using incorrect libcrypto.so library.
You can run the boringssl-self-test with strace and check for the issue.
In file : external/boringssl/selftest/boringssl_self_test.rc
service boringssl_self_test64_vendor /system/bin/strace -tt /vendor/bin/boringssl_self_test64
setenv BORINGSSL_SELF_TEST_CREATE_FLAG true # Any nonempty value counts as true
#reboot_on_failure reboot,boringssl-self-check-failed
stdio_to_kmsg
seclabel u:r:vendor_boringssl_self_test:s0

ifconfig wlan0 up causing kernel crash and reboots

I am testing Relatek Wi-Fi Driver in Android LOllipop. The driver is registered as
usbcore: registered new interface driver rtl8192du
And the lsmod shows the output as
8192du 488167 0 - Live 0x00000000
The driver is inserted successfully . And the netcfg output shows that the wlan0 interface is down.
I tried to make the interface active as ifconfig wlan0 up and suddenly the kernel crashes and reboots after 5 seconds.
What are the reasons for the ifconfig to fail especially to crash the kernel?.....Any help would be appreciated
The kernel crash log is provided below
e[<8031bcf4>] (vsnprintf+0x38/0x424) from [<8004b534>] (kthread_create_on_node+0x98/0xdc)
[<8004b534>] (kthread_create_on_node+0x98/0xdc) from [<7f03d05c>] (rtw_start_drv_threads+0x20/0x5c [8192du])
[<80647c24>] (__dev_open+0xa0/0xfc) from [<80647e58>] (__dev_change_flags+0x8c/0x128)
[<80647e58>] (__dev_change_flags+0x8c/0x128) from [<80647f60>] (dev_change_flags+0x10/0x48)
[<80647f60>] (dev_change_flags+0x10/0x48) from [<806d16ac>] (devinet_ioctl+0x780/0x828)
[<806d16ac>] (devinet_ioctl+0x780/0x828) from [<806323c8>] (sock_ioctl+0x68/0x28c)
[<806323c8>] (sock_ioctl+0x68/0x28c) from [<800f09e8>] (do_vfs_ioctl+0x80/0x5bc)
[<800f09e8>] (do_vfs_ioctl+0x80/0x5bc) from [<800f0f94>] (SyS_ioctl+0x70/0x78)
[<800f0f94>] (SyS_ioctl+0x70/0x78) from [<8000e0c0>] (ret_fast_syscall+0x0/0x30)
Code: ba0000ee e59da014 e3a0b020 e59d1018 (e5d23000)
---[ end trace ffb896cf8181c101 ]---
Kernel panic - not syncing: Fatal exception
So many reasons..... but...
1) post backtrace (kernel backtrace) for more information
2) suspect ioctl which is connect to ifconfig - bring up the wlan (if it's not ioctl, then something else like proc, netlink or whatever to communicate kernel)
3) the vap (wlan) enable code itself
I think that we may need crash backtrace and we can understand it better....

Kernel Configuration - Nexus Platform join failed

I am doing kernel configuration for ICS. I needed to enable Posix message queue as it is required in one of our applications. But enabling this option resulted in error. The make was successfull. But the image could not be loaded. The dmesg was:-
disagrees about version of symbol module_layout.
init: untracked pid 2038 exited.
logcat :-
mknod : '/dev/nexus_proxy' failed
NEXUS_Platform_Join [CONSTRUCTOR] failed.
Looks like you rebuilt only the kernel.
You need to build any kernel-modules (*.ko files) and
update them onto the filesystem.
Here is a detailed discussion on the disagrees about version of symbol error.

error while starting self-compiled android in vm

i am getting following errors on starting the android vm (compiled from froyo branch) in virtual-box 4.0.4
D/ALSAModule(1985)open called for devices 00000002 in mode 0...
E/ALSALib (1985)external/alsa-lib/src/pcm/pcm.c:2203:(snd_pcm_open_noupdate) Unknown PCM AndroidPlayback_Speaker_normal
E/ALSALib (1985)external/alsa-lib/src/pcm/pcm.c:2203:(snd_pcm_open_noupdate) Unknown PCM AndroidPlayback_Speaker
E/ALSALib (1985)external/alsa-lib/src/pcm/pcm.c:2203:(snd_pcm_open_noupdate) Unknown PCM AndroidPlayback
D/ (1985)[external/alsa-lib/src/pcm/pcm_hw.c]:snd_pcm_hw_prepare
I/ALSAModule(1985)Initialized ALSA PLAYBACK device default
it seems the problem is with sound device (or ALSA) but I am not sure. Any help is appreciated.
I think that you are missing alsa config in your system image. Check if /system/etc/asound.conf is present or not. Try creating a new config file with default configuration. Check THIS for more details

Categories

Resources