public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, Mike Isely <isely@isely.net>
Subject: Re: RFC: exposing controls in sysfs
Date: Tue, 06 Apr 2010 10:16:13 -0300	[thread overview]
Message-ID: <4BBB341D.2010300@redhat.com> (raw)
In-Reply-To: <201004060837.24770.hverkuil@xs4all.nl>

Hans Verkuil wrote:
> On Tuesday 06 April 2010 00:12:48 Hans Verkuil wrote:
>> On Monday 05 April 2010 23:47:10 Hans Verkuil wrote:
>>> Hi all,
>>>
>>> The new control framework makes it very easy to expose controls in sysfs.
>>> The way it is implemented now in the framework is that each device node
>>> will get a 'controls' subdirectory in sysfs. Below which are all the controls
>>> associated with that device node.
>>>
>>> So different device nodes can have different controls if so desired.
>>>
>>> The name of each sysfs file is derived from the control name, basically making
>>> it lowercase, replacing ' ', '-' and '_' with '_' and skipping any other non-
>>> alphanumerical characters. Seems to work well.
>>>
>>> For numerical controls you can write numbers in decimal, octal or hexadecimal.
>>>
>>> When you write to a button control it will ignore what you wrote, but still
>>> execute the action.
>>>
>>> It looks like this for ivtv:
>>>
>>> $ ls /sys/class/video4linux/video1
>>> controls  dev  device  index  name  power  subsystem  uevent
>>>
>>> $ ls /sys/class/video4linux/video1/controls
>>> audio_crc                    chroma_gain                   spatial_chroma_filter_type  video_bitrate_mode
>>> audio_emphasis               contrast                      spatial_filter              video_encoding
>>> audio_encoding               hue                           spatial_filter_mode         video_gop_closure
>>> audio_layer_ii_bitrate       insert_navigation_packets     spatial_luma_filter_type    video_gop_size
>>> audio_mute                   median_chroma_filter_maximum  stream_type                 video_mute
>>> audio_sampling_frequency     median_chroma_filter_minimum  stream_vbi_format           video_mute_yuv
>>> audio_stereo_mode            median_filter_type            temporal_filter             video_peak_bitrate
>>> audio_stereo_mode_extension  median_luma_filter_maximum    temporal_filter_mode        video_temporal_decimation
>>> balance                      median_luma_filter_minimum    video_aspect                volume
>>> brightness                   mute                          video_b_frames
>>> chroma_agc                   saturation                    video_bitrate
>>>
>>>
>>> The question is, is this sufficient?
>> 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.
> 
> Replying to your own mails is probably a bad sign, but I can't help myself :-)
> 
> I've changed the code to add a control class prefix for all but the user controls.
> It looks much better now:
> 
> $ ls /sys/class/video4linux/video1/controls
> balance                           mpeg_insert_navigation_packets     mpeg_video_aspect
> brightness                        mpeg_median_chroma_filter_maximum  mpeg_video_b_frames
> chroma_agc                        mpeg_median_chroma_filter_minimum  mpeg_video_bitrate
> chroma_gain                       mpeg_median_filter_type            mpeg_video_bitrate_mode
> contrast                          mpeg_median_luma_filter_maximum    mpeg_video_encoding
> hue                               mpeg_median_luma_filter_minimum    mpeg_video_gop_closure
> mpeg_audio_crc                    mpeg_spatial_chroma_filter_type    mpeg_video_gop_size
> mpeg_audio_emphasis               mpeg_spatial_filter                mpeg_video_mute
> mpeg_audio_encoding               mpeg_spatial_filter_mode           mpeg_video_mute_yuv
> mpeg_audio_layer_ii_bitrate       mpeg_spatial_luma_filter_type      mpeg_video_peak_bitrate
> mpeg_audio_mute                   mpeg_stream_type                   mpeg_video_temporal_decimation
> mpeg_audio_sampling_frequency     mpeg_stream_vbi_format             mute
> mpeg_audio_stereo_mode            mpeg_temporal_filter               saturation
> mpeg_audio_stereo_mode_extension  mpeg_temporal_filter_mode          volume


It would be more intuitive if you group the classes with a few subdirs:

/video/balance
/video/brightness
...
/mpeg_audio/crc
/mpeg_audio/mute
...
/audio/volume
/audio/bass
/audio/treble
..

-- 

Cheers,
Mauro

  parent reply	other threads:[~2010-04-06 13: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 [this message]
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
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=4BBB341D.2010300@redhat.com \
    --to=mchehab@redhat.com \
    --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