Index | Thread | Search

From:
Matthieu Herrb <matthieu@openbsd.org>
Subject:
Re: Adding rumble/force feedback control to ujoy(4)
To:
Thomas Frohwein <tfrohwein@fastmail.com>
Cc:
tech@openbsd.org
Date:
Sun, 24 Nov 2024 08:30:03 +0100

Download raw body.

Thread
On Fri, Nov 22, 2024 at 07:38:06PM -0500, Thomas Frohwein wrote:
> On Wed, 20 Nov 2024 21:52:03 +0100
> Matthieu Herrb <matthieu@herrb.eu> wrote:
> 
> > > +
> > > +#define UJOYIO_RUMBLE	_IOW('J', 7, struct ujoy_rumble)
> > > +  
> > 
> > Doesn't the '_IOW()' here mean that you need write access to
> > /dev/ujoy/<n> to use that ioctl() ?
> 
> While a little out of my depth, I've had some discussions and based on
> that and also [1], the choice of _IO{W,R,WR}() depends on if a struct
> is sent (written) to the kernel and/or read.
> 
> The filesystem permissions for /dev/ujoy//<n> are for open(2) calls,
> but ioctl(2) is different. For what it's worth the implementation in my
> diff works fine without any write access, which appears to prove
> this..

I'll let other comment on this. It's not clear in my mind either where
the boundary should be. But note that with your patch and the current
permission model, any user can make your joystick vibrate.

> 
> > 
> > Also, even though I'm partly responsible for the current situation as
> > porter of the now defunct ISA joy(4) driver
> > (https://man.openbsd.org/OpenBSD-3.0/i386/joy),  I think one should
> > think about plugging it into wsmouse(4) (adding a
> > WSMOUSE_TYPE_JOYSTICK to let applications make the difference). IT
> > will make supporting them in libinput-openbsd easier.
> 
> This would seem to me like a large project, and how much need is there
> for joystick devices as part of wsmouse? The joystick/gamepad uses that
> I'm aware of are 99% via sdl/sdl2 and that doesn't have problems with
> using working via /dev/joy or /dev/ujoy...
> 
> Also that's not specific to the question of enabling the rumble/force
> feedback support for the ujoy(4) device that we already have, right?
> 
Yes that's a more general comment, and a much wider project. 
-- 
Matthieu Herrb