sysfs

how to use poll(2) or select(2) service call to watch a pseudo file for changes with Kotlin

这一生的挚爱 提交于 2021-01-07 02:42:10
问题 I am working with a DragonBoard 410C using Android 5.1 and Kotlin to experiment with the GPIO pins on the 40 pin low power connector. The library I'm using is using the sysfs interface for interacting with the GPIO pins which requires opening various pseudo files in /sys/class/gpio/ directory tree and reading and writing values to those files, see accessing GPIO low power connector on DragonBoard 410C running Android My understanding is that I can provision a GPIO pin as Input and Edge

what is the /sys/class/gpio/export and `/sys/class/gpio/unexport mechanism and what is the underlying sysfs functionality?

柔情痞子 提交于 2020-11-29 19:10:19
问题 Using the legacy sysfs GPIO under Android and Linux the first step in the process is toe export the particular GPIO pins you want to use. And when you are done with the GPIO pin to unexport it. I've been looking for an explanation of what the export command actually does however everything I've found is about the builtin bash command which has nothing to do with GPIO. Then I realized the actual command from the command line was echo 938 > /sys/class/gpio/export and /sys/class/gpio/export is a

what is the /sys/class/gpio/export and `/sys/class/gpio/unexport mechanism and what is the underlying sysfs functionality?

社会主义新天地 提交于 2020-11-29 19:05:53
问题 Using the legacy sysfs GPIO under Android and Linux the first step in the process is toe export the particular GPIO pins you want to use. And when you are done with the GPIO pin to unexport it. I've been looking for an explanation of what the export command actually does however everything I've found is about the builtin bash command which has nothing to do with GPIO. Then I realized the actual command from the command line was echo 938 > /sys/class/gpio/export and /sys/class/gpio/export is a

what is the /sys/class/gpio/export and `/sys/class/gpio/unexport mechanism and what is the underlying sysfs functionality?

删除回忆录丶 提交于 2020-11-29 19:05:38
问题 Using the legacy sysfs GPIO under Android and Linux the first step in the process is toe export the particular GPIO pins you want to use. And when you are done with the GPIO pin to unexport it. I've been looking for an explanation of what the export command actually does however everything I've found is about the builtin bash command which has nothing to do with GPIO. Then I realized the actual command from the command line was echo 938 > /sys/class/gpio/export and /sys/class/gpio/export is a

How can I detect a USB port being used for charging in Linux?

假装没事ソ 提交于 2020-01-15 06:54:11
问题 I'm using a USB port on the Raspberry Pi 3 Model B to charge an accessory via a USB magnetic charging cable. I want to detect when the cable is plugged in and removed from the Pi . I've been plugging in and removing this cable and looking for any traces of this being detected on Linux. So far, I've tried: monitoring udev events by udevadm monitor . tailing the system logs in /var/log etc. running an inotify watch on the /dev directory for new devices looking around in /sys/bus/usb/devices for

Reading a sysfs GPIO input pin (direction as “in”) always print a fixed value (0)

雨燕双飞 提交于 2020-01-06 02:25:06
问题 After enabling the GPIO device support in kernel device driver (Kernel verion 3.10.92 ) I wanted to read the value of an input pin of my GPIO expander through GPIO sysfs. After exporting and setting the direction as "in", on reading, the value is always given as 0 even after the event is happening which will change the pin value as 1 . While the output direction is working fine i.e. I am able to glow a LED by altering the value as 0 or 1 . Base address for my GPIO expander in GPIO sysfs is

Which filesystem to use to expose readings/limits for temperature sensor

霸气de小男生 提交于 2020-01-06 02:19:11
问题 I currently have the trouble of some hardware overheating regularly. Looking through the Linux kernel, I found that the thermal sensors are currently fully supported, however the preconfigured limits seem much too high. I am currently looking to modify the kernel module, but I am not sure what would be the best way to modify it. I would like the following: Have a file somewhere, where I can read the current temperature Have a couple of files I can use from userspace to modify the current

can we access “sysfs entry” in our android application directly?

情到浓时终转凉″ 提交于 2020-01-05 06:54:09
问题 I know that we are using jni as an interface with driver which allows android application framework to communicate with device driver. But i don't know exact reason that why we can't access those sysfs entries in our application directly? Please explain in detail. Thank you in advance. 回答1: Cannot access sysfs from application layer. I was trying to perform write on a sysfs file but failed. Have to necessarily go through android middleware framework and/or HAL layer. These services could be

Create sysfs entry from kernel module

蹲街弑〆低调 提交于 2020-01-02 09:09:23
问题 I want to pass a string > 1024 chars to my module (filesystem). As kernel parameters are limited to 1024 chars, someone recommended to use sysfs instead. I tried to include this example in my super.c class to create a string 'filename' & string 'code' entry in sysfs for my module. static decl_subsys(myfs, NULL, NULL); struct myfs_attr { struct attribute attr; char *value; }; static struct myfs_attr fname = { .attr.name="filename", .attr.owner = THIS_MODULE, .attr.mode = 0644, .value = "/my

How does linux kernel creates sysfs?

不想你离开。 提交于 2020-01-01 11:48:23
问题 I have started looking at linux kernel code for my OS course. In that I'm interested in sys file system (sysfs). I'm interested in finding out when and how sysfs gets created? Which files in linux kernel code generate this file system? I have setup linux kernel on my system and have started debugging through the code. I have referred to this document to understand sysfs file system : [sysfs] : https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt But this document explains only about