Closed toni1727 closed 3 years ago
That's Impossible I think, how do you put your printk? I think a possible is your driver could not running correct.
Hello and Happy new year!,
I'm using the LSM9DS1 sensor and i added the st_imu68 IIO driver into my kernel.
Inside /sys/bus/iio/devices i can read raw devices. So the driver is working fine.
But the app still cannot read the data.
This is the DTS File:
Dts file:
lsm9ds1_ag@6b { compatible = "st,lsm9ds1"; reg = <0x6B>; status = "okay"; interrupt-parent = <&intc>; interrupts = <0 89 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "ag_irq"; };
lsm9ds1_m@1e{ compatible = "st,lsm9ds1_magn"; reg = <0x1E>; status = "okay"; interrupt-parent = <&intc>; interrupts = <0 90 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "m_irq"; };
I have no idea how to configure interrupts. I have copied them from another site. it's okay?
interrupt-parent = <& intc>; interrupts = <0 90 IRQ_TYPE_LEVEL_HIGH>; interrupt-names = "m_irq";
Thank you!!
What is your irq pin? connect to CPU? You need to define irq pinmux in dts first.
I don't have an IRQ pin physically connected.
How would software interrupts be configured?
Best regards.
I have no touch this sensor before, and I think soft irq could be works, but you should confirm dts configuration is right (refer other board first?).
In addition,issue 'cat /proc/interrupts' command can observe your irq is working or not, try it, please. Thanks a lot!
Happy new year!
I have no idea if that interrupt is okay. I copied it. How do you configure a software interrupt? I thought it depended on each CPU, not the sensor.
The driver of the component is this:
I'm sure it's because of the interruptions, everything is configured well, the only thing that the component doesn't launch the events.
This is the Logs:
Just checked your log, I have some comment as following:
I recommend separated two part to debug: kernel layer and framework layer, and you need to confirm kernel layer has no problems first:
I saw the STMicro has example, and you should be refer it, but you have no connect physical irq, their example is connect real irq, so I think it's wrong: https://github.com/STMicroelectronics/STMems_Linux_IIO_drivers
And about this example, it has read sensor data command, do you try it before? you see device node was generated not means driver is correct, you have to find some command/tools to verify your driver's 'read' function is works: https://github.com/jsagfr/lsm9ds1
If read function works but app still faied, that should be permission/selinux problem, or missing some HIDL driver definition.
Good luck!
Thank you very much!
If I execute this command:
cat / sys / bus / iio / devices / iio \: device0 / in_accel_x_raw
Device or resource busy
I get that, but before I read it without problems. I think I get that because the HAL II layer is using it now.
App still failed
you can take out HAL layer from HIDL definition first, it's in device/fsl/imx7d/pico-imx7d/manifest.xml, should be has sensor relate tag, remove them first.
You need confirm for command executing works first.
I added SELinux policy (I hadn't done it before):
############################################################
STSensors.te
type STSensors, domain, mlstrustedsubject, coredomain;
type STSensors_exec, exec_type, file_type;
# Started by init
init_daemon_domain(STSensors)
# Access to /persist/STSensors
allow STSensors persist_file:dir r_dir_perms;
allow STSensors persist_STSensors_file:dir rw_dir_perms;
allow STSensors persist_STSensors_file:file create_file_perms;
# Access to /data/STSensorHAL
allow STSensors system_data_file:dir { create_dir_perms getattr };
allow STSensors system_data_file:file create_file_perms;
# This part is to be used if APK is used to get calibration data
allow STSensors app_data_file:dir { rw_dir_perms getattr };
allow STSensors app_data_file:file rw_file_perms;
############################################################
But I received two errors when I compile:
STSensors.te:8:ERROR 'unknown type persist_file' at token ';'
"ERROR: permissive domains not allowed in user builds\" violated by allow STSensors system_data_file:file { write create setattr append unlink rename }
By the way, If I take out HAL layer from HIDL definition:
pico_imx7:/ # cat /sys/bus/iio/devices/iio:device0/in_accel_x_raw
-51
pico_imx7:/ # cat /sys/bus/iio/devices/iio:device0/in_accel_x_raw
-50
pico_imx7:/ # cat /sys/bus/iio/devices/iio:device0/in_accel_x_raw
-595
pico_imx7:/ # cat /sys/bus/iio/devices/iio:device0/in_accel_x_raw
-1240
Also remember check your device node permission (0666 is recommended).
That's a bit complicated!! I suggest you can recover your manifest file first, because you're confirm your kernel layer has no problems, and add debug messages on HAL layer (confirm HAL driver already occupy device node first), observe HAL driver still get right output.
If no problem, keep trace JNI layer, but I think the root cause should be in HAL or permission as my experience.
Welcome to post your HAL debug message here, thanks.
May I close this issue ticket if no any update?
I haven't gotten it to work. I have contacted the developer of STMems_Android_Sensor_HAL_IIO Let's see if we are lucky.
Thanks a lot!
Good luck, hope have good news soon, keep updated here if possible, and welcome to ask question if you have concern on BSP part, thanks!
Merry Christmas!
I am trying to integrate an acceleration sensor and I have problems. The point is that I try to put records to debug but they don't appear! printk does not work for kernel debugging. Do I have to do something special for the logs to appear?
Thanks a lot.