Closed lukas1760 closed 4 years ago
Hi!
Clightd should already support ALS devices: https://github.com/FedeDP/Clightd/wiki/Sensors .
Is this working for you:
busctl call org.clightd.clightd /org/clightd/clightd/Sensor/Als org.clightd.clightd.Sensor IsAvailable "s" ""
?
@lukas1760 Any news on this?
No. Currently I have problem with basic funcionality. I have older version working with picamera on RPi3 with Stretch, but it didn't work on buster in my case. I can post any log if you want.
I can post any log if you want.
Yes, please!
Can you post systemctl status clightd.service
output?
clightd.service - Bus service to manage various screen related properties (gamma, dpms, backligh Loaded: loaded (/usr/lib/systemd/system/clightd.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2019-10-08 15:42:56 CEST; 2min 43s ago Main PID: 341 (clightd) Tasks: 2 (limit: 1480) Memory: 1.5M CGroup: /system.slice/clightd.service \u2514\u2500341 /usr/lib/clightd/clightd
Oct 08 15:42:54 raspberrypi systemd[1]: Starting Bus service to manage various screen related prop Oct 08 15:42:55 raspberrypi clightd[341]: Registered Als sensor. Oct 08 15:42:55 raspberrypi clightd[341]: Registered Camera sensor. Oct 08 15:42:55 raspberrypi clightd[341]: (watch_displays_using_udev) Starting Oct 08 15:42:56 raspberrypi systemd[1]: Started Bus service to manage various screen related prope ~ but I have no config file in home/user/.config directory and also no log file in home/user directory
and ALS sensor is CJMCU-88
It seems that Clightd is correctly working.
What about clight?
Which versions are you on?
Btw can you try busctl call org.clightd.clightd /org/clightd/clightd/Sensor/Als org.clightd.clightd.Sensor IsAvailable "s" ""
to test taking a capture with your ALS sensor?
I tried it yesterday so it's the last version. reply on your command is sb "" false
Ok, so clightd cannot see any ALS device.
Can you share your ls /sys/class/als
output?
hmm..I don't have als folder in /sys/class but if I try i2cdetect -y 1, I see it in the matrix.
What about ls /sys/bus/acpi/drivers/acpi_als/
?
nothing. I have only this in /sys/bus/ directory amba cpu hid media nvmem serial clockevents event_source i2c mipi-dsi platform spi clocksource genpd iscsi_flashnode mmc scsi usb container gpio mdio_bus mmc_rpmb sdio workqueue
and /sys/class/
backlight graphics iscsi_session raw thermal bcm2708_vcio hidraw iscsi_transport rc tty bcm2835-gpiomem hwmon leds regulator uio bdi i2c-adapter lirc rfkill usbmisc block i2c-dev mdio_bus rtc vc bluetooth ieee80211 mem scsi_device vchiq bsg input misc scsi_disk vc-mem devcoredump iscsi_connection mmc_host scsi_host vc-sm dma iscsi_endpoint net sound video4linux drm iscsi_host power_supply spi_master vtconsole gpio iscsi_iface pwm spi_slave watchdog
It seems like your ALS device is not using acpi-als driver (that is supported by clightd).
Can you share with me udevadm monitor
output while attaching the ALS device?
Ie: you start "udevadm monitor" and then, while monitor is running, you attach the device.
Ps: what about ls /sys/bus/iio/devices/
too?
udevadm monitor nothing will happen...
i don't have iio directory
What about ls /sys/class/backlight/
?
This directory is empty. Could you write the exact name or paste link on supported device?
Clightd supports devices through iio::acpi-als kernel module. Have a look here: https://01.org/linuxgraphics/gfx-docs/drm/driver-api/iio/core.html#industrial-i-o-devices. It seems like your device driver does not expose any iio subsystem interface...
Mmh after quite a long search, i can say that: CJMCU-88 als chip is TMD27713 by Ams, here its databook: https://iq.components-store.com/datasheets/00/TMD27713.pdf.
It seems like there is in-kernel support for it, in iio subsystem: https://github.com/torvalds/linux/blob/master/drivers/iio/light/tsl2772.c, thus theoretically it should work fine.
It was moved out of staging on 12 may 2018: https://github.com/torvalds/linux/commits/master/drivers/iio/light/tsl2772.c.
If you have an older kernel, you should build its support from staging.
Great job! But I have no idea how to do it. :) Anyway it also doesn't work even if only pi camera is connected. As I said..
No. Currently I have problem with basic funcionality. I have older version working with picamera on RPi3 with Stretch, but it didn't work on buster in my case. I can post any log if you want.
Mmmh ok let's fix that then!
Which Clight/Clightd/libmodule versions are you using? On which OS?
It's raspbian buster with latest libmodule. It is fresh install without anything else. Just OS, clight and also dependencies
Thus you are using libmodule 5.0.0 and clight/clightd from git master, can confirm?
Can you paste here clight log from a --verbose run?
Agree. Here is log from /.local/share/clight/clight.log. I think that is the same. clight.log
Agree. Here is log from /.local/share/clight/clight.log. I think that is the same.
That is a different issue upon Clight :) I have found the root cause and i will fix it asap! In the meantime, you could set a fixed location or uncomment "no_gamma = true;" line in conf file.
And btw thanks for spotting this issue!
Sorry, My bad. :-) I disabled gamma so now I’m waiting for your answer. Your welcome!
So, is it working fine now, with gamma disabled? :)
Unfortunately no. Camera is connected, checked with ffplay command but still not working. Here is status of clightd.service
clightd.service - Bus service to manage various screen related properties (gamma, dpms, backlight) Loaded: loaded (/usr/lib/systemd/system/clightd.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2019-11-03 15:56:14 CET; 3 days ago Main PID: 354 (clightd) Tasks: 2 (limit: 1480) Memory: 2.0M CGroup: /system.slice/clightd.service \u2514\u2500354 /usr/lib/clightd/clightd
Nov 03 15:56:12 raspberrypi systemd[1]: Starting Bus service to manage various screen related properties (gamma, dpms, Nov 03 15:56:14 raspberrypi clightd[354]: Registered Als sensor. Nov 03 15:56:14 raspberrypi clightd[354]: Registered Camera sensor. Nov 03 15:56:14 raspberrypi clightd[354]: (watch_displays_using_udev) Starting Nov 03 15:56:14 raspberrypi systemd[1]: Started Bus service to manage various screen related properties (gamma, dpms, b Nov 03 15:56:26 raspberrypi clightd[354]: No video capture device: Success Nov 03 15:56:36 raspberrypi clightd[354]: No video capture device: Success Nov 06 18:23:55 raspberrypi clightd[354]: No video capture device: Success Nov 06 18:26:17 raspberrypi clightd[354]: No video capture device: Success
EDIT: now it's working. It was necessary to manually setup video device in config file. So what about the ALS sensor? Do you have idea how to build it? Thanks
now it's working. It was necessary to manually setup video device in config file
Great to know! Note also that latest Clight commit: https://github.com/FedeDP/Clight/commit/ebe7f7042e9ce516dc6e47da94f55f5925acdcec should address that issue!
So what about the ALS sensor?
What's your current kernel version? uname -a
will tell us!
Good job! Linux raspberrypi 4.19.75-v7+ #1270 SMP Tue Sep 24 18:45:11 BST 2019 armv7l
Your kernel was release @Sat, 21 Sep 2019 08:36:07; it means it already has correct driver out of staging.
Maybe it is not built for raspbian?
What is your sudo depmod -av | grep tsl2772
output?
If it does not output anything, you are out of luck and it seems you'll have to build the kernel module manually.
Like you said. No output. :-(
Ok then you should build drivers/iio/light/tsl2772.c kernel module! You can follow archwiki page or any of the resources online, eg: https://askubuntu.com/questions/168279/how-do-i-build-a-single-in-tree-kernel-module.
For comparison, this is my depmod output:
sudo depmod -av | grep tsl27
/lib/modules/5.3.0-19-generic/kernel/drivers/iio/light/tsl2772.ko needs "iio_push_event": /lib/modules/5.3.0-19-generic/kernel/drivers/iio/industrialio.ko
I spent little bit more time on it and now I have kernel module. Actually my depmod output is same like your but I don't now how to setup sensor in clight
I spent little bit more time on it and now I have kernel module.
Great to hear! Sorry for not being helpful but i am quite busy at the moment :)
Can you try a:
busctl call org.clightd.clightd /org/clightd/clightd/Sensor/Als org.clightd.clightd.Sensor IsAvailable "s" ""
?
If it still does not work, can you try to forcefully modprobe the kernel module (ie: sudo modprobe tsl2772
) and run it again?
It's okay, I have a lot of work too. :) Output is the same: sb "" false Module is loaded automatically at startup and also I see it in lsmod output. Maybe bad driver? I don't know where is the problem. :(
What does udevadm monitor
say now that you have correct driver?
If udev is empty too, what does dmesg
say when you attach your device?
What does udevadm monitor say now that you have correct driver?
nothing
If udev is empty too, what does dmesg say when you attach your device?
This is the only log about your driver in dmesg:
[ 4.896924] tsl2772: no symbol version for module_layout [ 4.896963] tsl2772: loading out-of-tree module taints kernel.
But then it gets loaded as you see int in lsmod output. It seems like it does not see any device though...
It's weird because I see address of this sensor in output of i2cdetect -y 1
Mmmh i am out of ideas indeed. You can try to read a guide, eg: https://bootlin.com/blog/building-a-linux-system-for-the-stm32mp1-connecting-an-i2c-sensor/ , and check if we did anything wrong... (look for "iio" in the article). Everything looks fine to me though...
Hi! Can you try to modprobe acpi_als
driver? It is a driver to interface with als iio; clightd uses that.
Hi! At first... happy new year!
Hi! Can you try to modprobe acpi_als driver? It is a driver to interface with als iio; clightd uses that.
no i don't have acpi_als driver, also I didn't find it in lsmod
I think that rpi don't have acpi support
Thanks! Can you share output of ls /sys/bus/iio/devices
?
Happy new year!
I'll close this issue in favor of #34; hopefully i will be able to finally fix als support for you too :)
Is there a way to use a i2c ALS device (CJMCU-88) instead of camera on Raspbian to detect the light intensity?