public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@cam.ac.uk>
To: Mike Isely <isely@isely.net>
Cc: Hans Verkuil <hverkuil@xs4all.nl>, linux-media@vger.kernel.org
Subject: Re: RFC: exposing controls in sysfs
Date: Tue, 06 Apr 2010 17:19:30 +0100	[thread overview]
Message-ID: <4BBB5F12.5040102@cam.ac.uk> (raw)
In-Reply-To: <alpine.DEB.1.10.1004060933550.27169@cnc.isely.net>

On 04/06/10 15:41, Mike Isely wrote:
> On Tue, 6 Apr 2010, Hans Verkuil wrote:
> 
>    [...]
> 
>>
>> One thing that might be useful is to prefix the name with the control class
>> name. E.g. hue becomes user_hue and audio_crc becomes mpeg_audio_crc. It would
>> groups them better. Or one could make a controls/user and controls/mpeg
>> directory. That might not be such a bad idea actually.
> 
> I agree with grouping in concept, and using subdirectories is not a bad 
> thing.  Probably however you'd want to ensure that in the end all the 
> controls end up logically at the same depth in the tree.
> 
> 
>    [...]
> 
>>
>> An in between solution would be to add _type files. So you would have 
>> 'hue' and 'hue_type'. 'cat hue_type' would give something like:
>>
>> int 0 255 1 128 0x0000 Hue
>>
>> In other words 'type min max step flags name'.
> 
> There was I thought at some point in the past a kernel policy that sysfs 
> controls were supposed to limit themselves to one value per node.
It's usually considered to be one 'conceptual' value per node, though
this falls fowl of that rule too.  So you could have one file with a list
of possible values, or even one for say hue_range 0...255 but people are
going to through a wobbly about antyhing with as much data in it as above.

The debate on this was actually pretty well covered in an lwn article the
other week. http://lwn.net/Articles/378884/

So the above hue type would probably need:

hue_type (int)
hue_range (0...255)
hue_step (1)
hue_flags (128)
hue_name (Hue)

Of those, hue_name doesn't in this case tell us anything and hue_step could
be suppressed as an obvious default.  It could be argued that parts of the
above could be considered a single 'conceptual' value but I don't think the
whole can be.  The reasoning behind this  (and it is definitely true with
your above example) is that sysfs should be human readable without needing
to reach for the documentation.
> 
>>
>> And for menu controls like stream_type (hmm, that would become 
>> stream_type_type...) you would get:
>>
>> menu 0 5 1 0 Stream Type

>> MPEG-2 Program Stream
>>
>> MPEG-1 System Stream
>> MPEG-2 DVD-compatible Stream
>> MPEG-1 VCD-compatible Stream
>> MPEG-2 SVCD-compatible Stream
>>
>> Note the empty line to denote the unsupported menu item (transport stream).
>>
>> This would give the same information with just a single extra file. Still not
>> sure whether it is worth it though.
> 
> Just remember that the more complex / subtle you make the node contents, 
> then the more parsing will be required for any program that tries to use 
> it.  I also think it's probably a bad idea for example to define a 
> format where the whitespace conveys additional information.  The case 
> where I've seen whitespace as part of the syntax actually work cleanly 
> is in Python.
> 
> 


  reply	other threads:[~2010-04-06 16:16 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-05 21:47 RFC: exposing controls in sysfs Hans Verkuil
2010-04-05 22:12 ` Hans Verkuil
2010-04-06  6:37   ` Hans Verkuil
2010-04-06 11:06     ` Andy Walls
2010-04-06 11:27       ` Laurent Pinchart
2010-04-06 11:44         ` Markus Rechberger
2010-04-06 15:08           ` Mike Isely
2010-04-06 15:16         ` Mike Isely
2010-04-06 22:39           ` Hans Verkuil
2010-04-07  2:10             ` hermann pitton
2010-04-07  6:56             ` Hans Verkuil
2010-04-08  0:52               ` Mike Isely
2010-04-06 13:16     ` Mauro Carvalho Chehab
2010-04-06 13:44       ` Hans Verkuil
2010-04-06 13:59         ` Devin Heitmueller
2010-04-06 15:05           ` Mike Isely
2010-04-06 14:32         ` Mauro Carvalho Chehab
2010-04-06 16:06           ` Jonathan Cameron
2010-04-06 16:36             ` Bjørn Forsman
2010-04-06 14:41   ` Mike Isely
2010-04-06 16:19     ` Jonathan Cameron [this message]
2010-04-06 22:47       ` Hans Verkuil
2010-04-06 14:33 ` Mike Isely
2010-04-07 18:50   ` Lars Hanisch
2010-04-07 22:15     ` hermann pitton
2010-04-08  0:47       ` Mike Isely
2010-04-08  0:58         ` Mike Isely
2010-04-08 17:57         ` Lars Hanisch

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=4BBB5F12.5040102@cam.ac.uk \
    --to=jic23@cam.ac.uk \
    --cc=hverkuil@xs4all.nl \
    --cc=isely@isely.net \
    --cc=linux-media@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