No output from IIO (character) device output - IIO buffer
The code is correct and working. I'm stupid - I didn't realized that cat command won't print invisible caharacters!
Use rather hexdump for example..
Reading IIO device data from User Space
I believe your issue relates to that fact you didn't enable any of the scan elements.
Scan elements located in :
/sys/bus/iio/devices/iio:device[x]/scan_elements.
Here you should enable which scan elements you want to capture. yo should have 3 file with the suffix : _en , _index and _type.
_type refer to the type of the scan , index is the channel that will be allocated for the scan in the device read and _en which state "enable". just write a "1" to the scan _en file you wish to enable , write to the /buffer/length 100 and /buffer/enable "1" and you should start getting data.
I dont think this is your issue because you would probably not be able to enable the buffer at all but, you may need to enable a trigger which should also be located in /sys/bus/iio/devices. you should have trigger1/2/3 directories here, depend on number of IIO devices you have. you may need to write down the trigger name to /sys/bus/iio/devices/iio:device[x]/trigger/current_trigger.
So you should do :
echo /sys/bus/iio/devices/trigger[x]/name >
/sys/bus/iio/devices/iio:device[x]/trigger/current_trigger
hope thats help.
Reading from char device using read() with pointer to buffer
Ignoring the reading business, the only reason for the printf to produce a SEGV is that buff points someplace outside the process's valid memory. So use printf("%p", buff) and find out where buff is pointing, and sprinkle these in your code until you find out when it stops pointing to the address that malloc returned.
Related Topics
Mmap Flag Map_Uninitialized Not Defined
Linux - Mapping User Space Memory in Kernel Code
How to Attach Domain Name to My Server
Linux: How to Check The Largest Contiguous Address Range Available to a Process
Source Bashrc Doesn't Work in Cron
How to Get a Faster Output Pipe Than /Dev/Null
Error Installing 'Topicmodels' Package, Non Zero Exit Status; Ubuntu
Permission Denied: '/Var/Lib/Pgadmin/Sessions' in Docker
Print Bash Script Result Behind Prompt in The Next Line
Sed to Loop Through File and Replace Placeholder Variables
Linux Telnet Vt100 Return Key Sends ^M
Nvcc Cuda Cross Compiling Cannot Find "-Lcudart"
How to Tell Linux to Keep a Page and Not Evict It