No Output from Iio (Character) Device Output - Iio Buffer

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



Leave a reply



Submit