From: Ivo van Doorn <ivdoorn@gmail.com>
To: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
Cc: "Stephen Hemminger" <shemminger@linux-foundation.org>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
"John Linville" <linville@tuxdriver.com>,
"Jiri Benc" <jbenc@suse.cz>,
"Lennart Poettering" <lennart@poettering.net>,
"Johannes Berg" <johannes@sipsolutions.net>,
"Larry Finger" <Larry.Finger@lwfinger.net>
Subject: Re: [RFC] rfkill - Add support for input key to control wireless radio
Date: Fri, 30 Mar 2007 19:13:57 +0200 [thread overview]
Message-ID: <200703301913.57656.IvDoorn@gmail.com> (raw)
In-Reply-To: <d120d5000703300828k5baf3c7x3716148b2e08d17f@mail.gmail.com>
> > > There is also an input handler that catces KEY_WLAN and KEY_BLUETOOTH
> > > events passing through input system and toggles state of all RF
> > > switches of appropriate type registered with rfkill system (unless
> > > a switch was claimed by userspace in which case it is left alone).
> > > I think this provides basic functionality that most of the users need
> > > and any advanced control will have to be done from userspace.
> >
> > Shouldn't a KEY_IRDA be added as well?
> > It isn't currently defined in input.h yet, but perhaps it actually should?
> > Or is IRDA treated differently for a specific reason?
>
> Do we actually have cards with IRDA switches? We are kind of tight in
> input KEY_ namespace so I am hesitant to add defines before there
> actual users.
Ah ok. Well that shouldn't be a problem, IRDA could be added once there
are users for it. I am not sure if there are any devices with IRDA switches,
so it shouldn't be a big problem.
> > > In a followup patch there is a skeleton code for creating polled
> > > input devices. For cards that have button physically connected
> > > their drivers will have to register a separate input device and
> > > let either input handler or userspace application take care of
> > > switching RF state appropriately.
> > >
> > > My only concern is where rfkill code should live. Since it is no
> > > longer dependent on input core (embedded systems might disable
> > > rfkill-input and use bare rfkill and control state from userspace)
> > > it does not need to live in drivers/input.
> >
> > How about:
> > rfkill -> drivers/misc
>
> Not in net?
Well in drivers/net are the network drivers but not the irda and bluetooth drivers,
those are located in different folders in drivers/ so I think misc would be the most
suitable location.
> > rfkill_input -> input/misc
>
> I can go both ways on this one as it crosses line between input and
> rfkill. I think from user/Kconfig point of view it is better to keep
> it together with rfkill: user woudl select rfkill option and right
> then and there decide if he wants to give the kernel ability to
> automatically control RF switche
Makes sense.
> > input_polldev -> lib/ (perhaps small namechange to rfkill_polldev?)
>
> No, I do not want to change name - I have bunch of drivers that can me
> converted to use this skeleton - wistron, aaedkbd, hdaps, ams,
> cobalt_btns. It is also pure input-related function so it is the only
> module that definitely belongs to drivers/input/misc.
Ok. :)
> > It would scatter the components a bit, but since each of those modules
> > has its own specific task this would make the most sense.
> > And by setting the depends and select fields for the menu entries correctly
> > it shouldn't be too big of a problem.
> >
> > > Please let me know what you think.
> >
> > Just to get it straight on how these 3 modules would cooperate (before I start mixing things up) ;)
> >
> > - rfkill
> > - Drivers register to the rfkill module, rfkill
> > - Provides the sysfs interface
> > - Drivers that don't require polling should report the events to this module
>
> Not quite. Drivers that have buttons do not require polling still
> should create an input device and register it with input layer. Except
> that with interrupt-driven devices there is not much you can stub out
> so you just have to do input_allocate_device/input_register_device.
>
> >
> > - rfkill_input
> > - Provides input device visible to userspace
> >
>
> No, rfkill-input is not an input device but input handler (or input
> interface). It routes input events from buttons into switches (see
> below).
>
> > - input_polldev
> > - Handlers polling, where the driver should check what the previous state was and the driver
> > should send the event to rfkill.
>
> This is the input device visible to userspace and kernel. It polls
> state of the button and sends KEY_WLAN/KEY_BLUETOOTH events through
> input layer. They get distributed through various input handlers such
> as evdev and rfkill-input. Evdev provides route for events to
> userspace where application can listen to events and then toggle RF
> switches according to the current policy via
> /sys/class/rfkill/rfkillXXX/state. Rfkill-input provides in-kernel
> route for events into rfkill system. If rfkill-input is loaded
> switches that are not claimed by userspace will be toggled
> automatically.
>
> Does this make sense?
Yes, but what if the user loads both modules or has them both compiled in?
Shouldn't there be some protection against that, since both handlers should not
be active at the same time.
> Note that we don't start polling the state of button until tare are
> users of that input device. If rfkill-input is loaded then there is a
> user right away. Otherwise we wait for userspace to open evdev node.
Sounds good.
> > personally I would prefer enforcing drivers to call
> > allocate()
> > register()
> > unregister()
> > free()
> >
> > Especially with unregister() doing the same steps as free() (put_device)
> > might be somwhat confusing. But might be just me. ;)
> >
>
> I know but for refcounted objects you can't really tell when they will
> actually be freed. It depends when their last user drops off.
Then perhaps rfkill_register could call put_device() when it fails, and free()
can be removed entirely. That way it would we prevent some driver
to call free() anyway.
> BTW, I can't either as I don't have any laptops with RF swtches ;)
If I am not mistaken, Larry (CC'ed during most of this discussion) does have such
a device _and_ he knows more about the bcm43xx drivers. :)
Larry, if you have time, could you make a test run with the patches Dmitry has send?
Ivo
next prev parent reply other threads:[~2007-03-30 17:14 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-03 18:36 [RFC] rfkill - Add support for input key to control wireless radio Ivo van Doorn
2006-12-03 19:18 ` Arjan van de Ven
2006-12-03 22:03 ` Ivo van Doorn
2006-12-03 19:20 ` Arjan van de Ven
2006-12-03 22:05 ` Ivo van Doorn
2006-12-03 22:28 ` Ivo van Doorn
2006-12-05 0:18 ` Randy Dunlap
2006-12-05 21:20 ` Ivo van Doorn
2006-12-03 19:44 ` Dan Williams
2006-12-03 22:16 ` Ivo van Doorn
2006-12-04 8:53 ` Marcel Holtmann
2006-12-04 22:15 ` Dmitry Torokhov
2006-12-04 23:27 ` Ivo van Doorn
2006-12-06 14:37 ` Dmitry Torokhov
2006-12-06 15:18 ` Dan Williams
2006-12-06 15:24 ` Dmitry Torokhov
2006-12-06 19:31 ` Ivo van Doorn
2006-12-06 20:18 ` Dmitry Torokhov
2006-12-06 21:41 ` Ivo van Doorn
2006-12-06 22:04 ` Dmitry Torokhov
2006-12-07 21:53 ` Ivo van Doorn
2006-12-12 5:12 ` Dmitry Torokhov
2006-12-12 7:47 ` Ivo Van Doorn
2006-12-17 17:43 ` Ivo van Doorn
2007-01-30 16:33 ` Ivo van Doorn
2006-12-07 13:22 ` Dan Williams
2006-12-07 21:58 ` Ivo van Doorn
2006-12-06 22:05 ` Jiri Benc
2006-12-06 22:10 ` Dmitry Torokhov
2006-12-05 10:32 ` Christoph Hellwig
2006-12-05 21:21 ` Ivo van Doorn
2007-01-31 3:40 ` Stephen Hemminger
2007-01-31 10:39 ` Ivo van Doorn
2007-01-31 11:20 ` Ivo van Doorn
2007-03-30 5:27 ` Dmitry Torokhov
2007-03-30 5:29 ` Dmitry Torokhov
2007-03-30 14:59 ` Ivo van Doorn
2007-03-30 15:28 ` Dmitry Torokhov
2007-03-30 17:13 ` Ivo van Doorn [this message]
2007-03-30 18:37 ` Dmitry Torokhov
2007-03-31 12:49 ` Ivo van Doorn
2007-04-02 4:38 ` Dmitry Torokhov
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=200703301913.57656.IvDoorn@gmail.com \
--to=ivdoorn@gmail.com \
--cc=Larry.Finger@lwfinger.net \
--cc=dmitry.torokhov@gmail.com \
--cc=jbenc@suse.cz \
--cc=johannes@sipsolutions.net \
--cc=lennart@poettering.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).