* fs: layered device driver to write to evdev
[not found] <CABDcava8ADBNrVNh+7A2jG-LgEipcapU8dVh8p+jX-D4kgfzRg@mail.gmail.com>
@ 2022-11-02 13:14 ` Guillermo Rodriguez Garcia
2022-11-02 22:19 ` Eric Biggers
2022-11-03 0:04 ` Luis Chamberlain
0 siblings, 2 replies; 5+ messages in thread
From: Guillermo Rodriguez Garcia @ 2022-11-02 13:14 UTC (permalink / raw)
To: linux-kernel, linux-fsdevel
Cc: Christoph Hellwig, Al Viro, Linus Torvalds, Luis Chamberlain,
Matthew Wilcox, Kees Cook, Iurii Zaikin
Hi all,
I have a number of embedded boards that integrate a pwm-based buzzer
device, and use the pwm-beeper device driver in order to control this.
However the pwm-beeper device driver only supports simple (play /
stop) ioctls, so I had implemented a "layered" device driver that
would talk to the pwm-beeper device (through evdev), and provide
additional ioctls to userspace so that an application could say e.g.
"beep for 50ms", and the driver would take care of the timing.
This layered device driver used set_fs + vfs_write to talk to the
underlying device. However, since [1] this no longer works.
I understand that device drivers should implement ->write_iter if they
need to be written from kernel space, but evdev does not support this.
What is the recommended way to have a layered device driver that can
talk to evdev ?
Thanks in advance,
(If possible, please CC me in any replies)
[1]: https://lore.kernel.org/lkml/20200626075836.1998185-9-hch@lst.de/
--
Guillermo Rodriguez Garcia
guille.rodriguez@gmail.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: fs: layered device driver to write to evdev
2022-11-02 13:14 ` fs: layered device driver to write to evdev Guillermo Rodriguez Garcia
@ 2022-11-02 22:19 ` Eric Biggers
2022-11-03 0:04 ` Luis Chamberlain
1 sibling, 0 replies; 5+ messages in thread
From: Eric Biggers @ 2022-11-02 22:19 UTC (permalink / raw)
To: Guillermo Rodriguez Garcia
Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Al Viro,
Linus Torvalds, Luis Chamberlain, Matthew Wilcox, Kees Cook,
Iurii Zaikin
On Wed, Nov 02, 2022 at 02:14:24PM +0100, Guillermo Rodriguez Garcia wrote:
> What is the recommended way to have a layered device driver that can
> talk to evdev ?
Don't do that. evdev is a userspace interface, not something for internal
kernel use. Just write userspace code that uses evdev to do what you want.
Or if it's really necessary, add features to the real device driver.
- Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: fs: layered device driver to write to evdev
2022-11-02 13:14 ` fs: layered device driver to write to evdev Guillermo Rodriguez Garcia
2022-11-02 22:19 ` Eric Biggers
@ 2022-11-03 0:04 ` Luis Chamberlain
2022-11-03 7:47 ` Christoph Hellwig
2022-11-03 8:22 ` Guillermo Rodriguez Garcia
1 sibling, 2 replies; 5+ messages in thread
From: Luis Chamberlain @ 2022-11-03 0:04 UTC (permalink / raw)
To: Guillermo Rodriguez Garcia
Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Al Viro,
Linus Torvalds, Matthew Wilcox, Kees Cook, Iurii Zaikin
On Wed, Nov 02, 2022 at 02:14:24PM +0100, Guillermo Rodriguez Garcia wrote:
> I understand that device drivers should implement ->write_iter if they
> need to be written from kernel space, but evdev does not support this.
> What is the recommended way to have a layered device driver that can
> talk to evdev ?
Shouldn't just writing write_iter support make this work?
Luis
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: fs: layered device driver to write to evdev
2022-11-03 0:04 ` Luis Chamberlain
@ 2022-11-03 7:47 ` Christoph Hellwig
2022-11-03 8:22 ` Guillermo Rodriguez Garcia
1 sibling, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2022-11-03 7:47 UTC (permalink / raw)
To: Luis Chamberlain
Cc: Guillermo Rodriguez Garcia, linux-kernel, linux-fsdevel,
Christoph Hellwig, Al Viro, Linus Torvalds, Matthew Wilcox,
Kees Cook, Iurii Zaikin
On Wed, Nov 02, 2022 at 05:04:11PM -0700, Luis Chamberlain wrote:
> On Wed, Nov 02, 2022 at 02:14:24PM +0100, Guillermo Rodriguez Garcia wrote:
> > I understand that device drivers should implement ->write_iter if they
> > need to be written from kernel space, but evdev does not support this.
> > What is the recommended way to have a layered device driver that can
> > talk to evdev ?
>
> Shouldn't just writing write_iter support make this work?
Writing to evdev just sound like a lot of troble. evdev is a tiny
wrapper to expose the in-kernel input API to userspace. Anything
in-kernel should just directly interact with the input subsystem.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: fs: layered device driver to write to evdev
2022-11-03 0:04 ` Luis Chamberlain
2022-11-03 7:47 ` Christoph Hellwig
@ 2022-11-03 8:22 ` Guillermo Rodriguez Garcia
1 sibling, 0 replies; 5+ messages in thread
From: Guillermo Rodriguez Garcia @ 2022-11-03 8:22 UTC (permalink / raw)
To: Luis Chamberlain
Cc: linux-kernel, linux-fsdevel, Christoph Hellwig, Al Viro,
Linus Torvalds, Matthew Wilcox, Kees Cook, Iurii Zaikin
El jue, 3 nov 2022 a las 1:04, Luis Chamberlain (<mcgrof@kernel.org>) escribió:
>
> On Wed, Nov 02, 2022 at 02:14:24PM +0100, Guillermo Rodriguez Garcia wrote:
> > I understand that device drivers should implement ->write_iter if they
> > need to be written from kernel space, but evdev does not support this.
> > What is the recommended way to have a layered device driver that can
> > talk to evdev ?
>
> Shouldn't just writing write_iter support make this work?
If I understand correctly, supporting both write and write_iter is not
allowed [1]:
"If a file has both the regular ->read/->write methods and the iter
variants those could have different semantics for messed up enough
drivers. Also fails the kernel access to them in that case."
[1]: https://lore.kernel.org/all/20200817073212.830069-3-hch@lst.de/
Thanks,
Guillermo Rodriguez Garcia
guille.rodriguez@gmail.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-11-03 8:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CABDcava8ADBNrVNh+7A2jG-LgEipcapU8dVh8p+jX-D4kgfzRg@mail.gmail.com>
2022-11-02 13:14 ` fs: layered device driver to write to evdev Guillermo Rodriguez Garcia
2022-11-02 22:19 ` Eric Biggers
2022-11-03 0:04 ` Luis Chamberlain
2022-11-03 7:47 ` Christoph Hellwig
2022-11-03 8:22 ` Guillermo Rodriguez Garcia
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).