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/[email protected]/
--
Guillermo Rodriguez Garcia
[email protected]
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
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
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.
El jue, 3 nov 2022 a las 1:04, Luis Chamberlain (<[email protected]>) 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/[email protected]/
Thanks,
Guillermo Rodriguez Garcia
[email protected]