From: Jonathan Cameron <jic23@kernel.org>
To: Chris Micali <chrismicali@gmail.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: IIO Drivers
Date: Wed, 27 Feb 2013 18:28:36 +0000 [thread overview]
Message-ID: <512E5054.8030905@kernel.org> (raw)
In-Reply-To: <5277B88AB1FF4E6A83920766C0BE13F7@gmail.com>
On 02/27/2013 05:36 PM, Chris Micali wrote:
> lars,
>
> I was under the impression that flag gets added automatically by iio_triggered_buffer_setup (industrialiio-triggers.c:77) - I actually am now able to enable the scan_element after changing my channel .channel and .scan_index to 0 (trying to match exactly the other drivers.)
Strange, scan_index should have defaulted to zero and the .channel value shouldn't have mattered
for buffered reads (just effects naming). Might have caused issues with userspace expecting a channel 0
though...
> When i run general_buffer (from the docs dir) with that scan element enabled it can no longer read the trigger (Could not open /trigger/current_trigger Failed to write current_trigger file) - this succeeds if that scan_element is not enabled.
>
> Is there a guide anywhere that captures the steps to setup and read from a driver that perhaps I missed?
Saddly there was a while back but it got so out of date that it because counter productive.
userspace wise, buffer_generic.c is the example of the steps.
Briefly.
1) Enable some channels via /sys/bus/iio/devices/iio:device0/scan_elements
2) Associate a trigger with the device. For the failed to write above are you specifying
a trigger? If not it'll guess the device is supplying one and try looking for that.
(which doesn't exist). Hmm. that error message could probably do with some detail!
3) Enable the buffer
4) Read from the associated chrdev.
>
> -c
>
>
> On Wednesday, February 27, 2013 at 12:34 PM, Lars-Peter Clausen wrote:
>
>> On 02/27/2013 06:15 PM, Chris Micali wrote:
>>> Lars,
>>>
>>> Thanks.. when I write 1 to scan_elements/in_voltage0_en via iio_cmdserv i get -2, from shell (echo 1>) i see write error: Invalid argument. No output in dmesg that indicates what the error is/could be though.
>>>
>>> -c
>>
>> In your driver you commented out the INDIO_BUFFER_TRIGGERED mode flag, did
>> you add that back? Without it this won't work.
>>
>> - Lars
>>
>>>
>>>
>>> On Wednesday, February 27, 2013 at 11:34 AM, Lars-Peter Clausen wrote:
>>>
>>>> On 02/27/2013 05:21 PM, Chris Micali wrote:
>>>>> Hi Lars,
>>>>> Thanks a lot for getting back to me. I've attached my code - it's pretty simple, I just copied an existing driver. As I mentioned individual reads are working fine (if i cat in_voltage0_raw) but buffered reads are failing. I've tracked the issue to industrialio-buffer.c in iio_compute_scan_bytes() which always returns zero because, i believe, the mask is 0. I haven't been able to find any docs on what 'scan masks' mean but I have seen a few drivers that supply available scan masks. Should I be specifying scan masks?
>>>>> Thanks!
>>>>> -chris
>>>>
>>>>
>>>>
>>>>
>>>> Hi Chris,
>>>>
>>>> You need to enable the channels you want to sample in sysfs. If you are
>>>> using the command server you can for example do this by doing a 'write
>>>> ads... scan_elements/in_voltage0_en'
>>>>
>>>> - Lars
>>>>
>>>>
>>>>>
>>>>>
>>>>> On Wednesday, February 27, 2013 at 11:07 AM, Lars-Peter Clausen wrote:
>>>>>
>>>>>> On 02/26/2013 08:56 PM, Chris Micali wrote:
>>>>>>> Hello Lars,
>>>>>>>
>>>>>>> I'm doing a bit of hacking on a IIO driver based on some of your drivers on a 3.8 kernel (specifically writing a driver for a TI SPI adc.) I've been able to get a driver up and working such that I can read directly from the in_voltage0_raw on sysfs and get the correct values but I can't seem to get buffered access working (via iio_cmdsrv.) I've had a hard time finding any docs on this stuff and I was wondering if you could give me any pointers on where to look or who else perhaps to ask about this stuff? Any pointers would be very much appreciated!
>>>>>>>
>>>>>>> Thanks,
>>>>>>> Chris
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm afraid except for the the documentation in
>>>>>> drivers/staging/iio/Documentation/, the kernel doc comments and the skeleton
>>>>>> driver (drivers/staging/iio/iio_simple_dummy*) there is not much additional
>>>>>> documentation available.
>>>>>>
>>>>>> The general place to ask questions about IIO is the IIO mailinglist. I've
>>>>>> put it on CC, hope you don't mind.
>>>>>>
>>>>>> I think we can help you best if you post your code.
>>>>>>
>>>>>> - Lars
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2013-02-27 18:28 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <26387F1A648A4D3D9BB4142C4F0AAE98@gmail.com>
2013-02-27 16:07 ` IIO Drivers Lars-Peter Clausen
2013-02-27 16:21 ` Chris Micali
2013-02-27 16:34 ` Lars-Peter Clausen
[not found] ` <4AEA8015FE824807B3CF62B7B35FC5D3@gmail.com>
2013-02-27 17:34 ` Lars-Peter Clausen
2013-02-27 17:36 ` Chris Micali
2013-02-27 18:28 ` Jonathan Cameron [this message]
2013-02-27 18:51 ` Lars-Peter Clausen
2013-02-27 19:32 ` Chris Micali
2013-02-27 19:50 ` Chris Micali
2013-02-27 20:02 ` Lars-Peter Clausen
2013-02-27 20:06 ` Chris Micali
2013-02-27 20:15 ` Lars-Peter Clausen
2013-02-27 20:25 ` Chris Micali
2013-03-02 16:27 ` Jonathan Cameron
2013-03-04 20:37 ` Chris Micali
2013-03-05 21:06 ` Lars-Peter Clausen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=512E5054.8030905@kernel.org \
--to=jic23@kernel.org \
--cc=chrismicali@gmail.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox