[systemd-devel] joystick doesn't respect seat rule

2014-05-28 Thread Floris

Hey,

I have created an udev rule for an usb hub with loginctl attach so every  
device I plug-in will go to seat1

$cat /etc/udev/rules.d/72-seat-usb-pci-_00_1a_0-usb-0_1_4.rules
TAG==seat, ENV{ID_FOR_SEAT}==usb-pci-_00_1a_0-usb-0_1_4,  
ENV{ID_SEAT}=seat1


Nevertheless, when I plug-in a joystick on seat1, it is also working on  
seat0


I would expect the same behavior as a keyboard or a mouse. A device on  
seat1 does not interact with seat0


$ jstest /dev/input/js0 #run on seat0
Driver version is 2.1.0.
Joystick (DragonRise Inc.   Generic   USB  Joystick  ) has 7 axes (X, Y,  
Z, Rx, Rz, Hat0X, Hat0Y)
and 12 buttons (Trigger, ThumbBtn, ThumbBtn2, TopBtn, TopBtn2, PinkieBtn,  
BaseBtn, BaseBtn2, BaseBtn3, BaseBtn4, BaseBtn5, BaseBtn6).

Testing ... (interrupt to exit)
...

$ udevadm info --query=all --name=input/js0
P:  
/devices/pci:00/:00:1a.0/usb1/1-1/1-1.4/1-1.4.3/1-1.4.3:1.0/0003:0079:0006.0008/input/input22/js0

N: input/js0
S: input/by-id/usb-DragonRise_Inc._Generic_USB_Joystick-joystick
S: input/by-path/pci-:00:1a.0-usb-0:1.4.3:1.0-joystick
E:  
DEVLINKS=/dev/input/by-id/usb-DragonRise_Inc._Generic_USB_Joystick-joystick  
/dev/input/by-path/pci-:00:1a.0-usb-0:1.4.3:1.0-joystick

E: DEVNAME=/dev/input/js0
E:  
DEVPATH=/devices/pci:00/:00:1a.0/usb1/1-1/1-1.4/1-1.4.3/1-1.4.3:1.0/0003:0079:0006.0008/input/input22/js0

E: ID_BUS=usb
E: ID_FOR_SEAT=input-pci-_00_1a_0-usb-0_1_4_3_1_0
E: ID_INPUT=1
E: ID_INPUT_JOYSTICK=1
E: ID_MODEL=Generic_USB_Joystick
E: ID_MODEL_ENC=Generic\x20\x20\x20USB\x20\x20Joystick\x20\x20
E: ID_MODEL_ID=0006
E: ID_PATH=pci-:00:1a.0-usb-0:1.4.3:1.0
E: ID_PATH_TAG=pci-_00_1a_0-usb-0_1_4_3_1_0
E: ID_REVISION=0107
E: ID_SEAT=seat1
E: ID_SERIAL=DragonRise_Inc._Generic_USB_Joystick
E: ID_TYPE=hid
E: ID_USB_DRIVER=usbhid
E: ID_USB_INTERFACES=:03:
E: ID_USB_INTERFACE_NUM=00
E: ID_VENDOR=DragonRise_Inc.
E: ID_VENDOR_ENC=DragonRise\x20Inc.\x20\x20
E: ID_VENDOR_ID=0079
E: MAJOR=13
E: MINOR=0
E: SUBSYSTEM=input
E: TAGS=:seat:seat1:uaccess:
E: USEC_INITIALIZED=776894
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] joystick doesn't respect seat rule

2014-05-28 Thread Mantas Mikulėnas
On Wed, May 28, 2014 at 5:28 PM, Floris jkflo...@dds.nl wrote:
 Hey,

 I have created an udev rule for an usb hub with loginctl attach so every
 device I plug-in will go to seat1
 $cat /etc/udev/rules.d/72-seat-usb-pci-_00_1a_0-usb-0_1_4.rules
 TAG==seat, ENV{ID_FOR_SEAT}==usb-pci-_00_1a_0-usb-0_1_4,
 ENV{ID_SEAT}=seat1

 Nevertheless, when I plug-in a joystick on seat1, it is also working on
 seat0

 I would expect the same behavior as a keyboard or a mouse. A device on seat1
 does not interact with seat0

 $ jstest /dev/input/js0 #run on seat0
 Driver version is 2.1.0.
 Joystick (DragonRise Inc.   Generic   USB  Joystick  ) has 7 axes (X, Y, Z,
 Rx, Rz, Hat0X, Hat0Y)
 and 12 buttons (Trigger, ThumbBtn, ThumbBtn2, TopBtn, TopBtn2, PinkieBtn,
 BaseBtn, BaseBtn2, BaseBtn3, BaseBtn4, BaseBtn5, BaseBtn6).
 Testing ... (interrupt to exit)

Are you logged in as the same user on both seats?

I think the difference is that with `jstest`, the device doesn't
interact with your seat, but *you* are interacting directly with its
device node, so the only thing that's checked is devnode
permissions...

-- 
Mantas Mikulėnas graw...@gmail.com
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] joystick doesn't respect seat rule

2014-05-28 Thread Floris

Are you logged in as the same user on both seats?



Nobody is logged in on seat1


I think the difference is that with `jstest`, the device doesn't
interact with your seat, but *you* are interacting directly with its
device node, so the only thing that's checked is devnode
permissions...



When I start a game on seat0 I can use the joystick attached to seat1
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] joystick doesn't respect seat rule

2014-05-28 Thread Zbigniew Jędrzejewski-Szmek
On Wed, May 28, 2014 at 05:45:01PM +0200, Floris wrote:
 Are you logged in as the same user on both seats?
 
 
 Nobody is logged in on seat1
 
 I think the difference is that with `jstest`, the device doesn't
 interact with your seat, but *you* are interacting directly with its
 device node, so the only thing that's checked is devnode
 permissions...
 
 
 When I start a game on seat0 I can use the joystick attached to seat1
What does 'getfacl /dev/input/js0' say? And 'loginctl seat-status seat1'?

Zbyszek

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] joystick doesn't respect seat rule

2014-05-28 Thread Floris
Op Wed, 28 May 2014 19:06:22 +0200 schreef Zbigniew Jędrzejewski-Szmek  
zbys...@in.waw.pl:



On Wed, May 28, 2014 at 05:45:01PM +0200, Floris wrote:

Are you logged in as the same user on both seats?


Nobody is logged in on seat1

I think the difference is that with `jstest`, the device doesn't
interact with your seat, but *you* are interacting directly with its
device node, so the only thing that's checked is devnode
permissions...


When I start a game on seat0 I can use the joystick attached to seat1

What does 'getfacl /dev/input/js0' say? And 'loginctl seat-status seat1'?

Zbyszek


$ getfacl /dev/input/js0
getfacl: Removing leading '/' from absolute path names
# file: dev/input/js0
# owner: root
# group: root
user::rw-
user:Debian-gdm:rw-
group::r--
mask::rw-
other::r--

$ loginctl seat-status seat1
seat1
Sessions: *c1
 Devices:
  ├─/sys/devices/pci:00/:00:05.0/:02:00.0
  │ [MASTER] pci::02:00.0
  
├─/sys/devices/pci:00/:00:05.0/:02:00.1/sound/card1
  │ sound:card1 NVidia
  │  
├─/sys/devices/pci:00/:00:05.0/:02:00.1/sound/card1/input14

  │ │ input:input14 HDA NVidia HDMI/DP,pcm=7
  │  
└─/sys/devices/pci:00/:00:05.0/:02:00.1/sound/card1/input5

  │   input:input5 HDA NVidia HDMI/DP,pcm=3
  ├─/sys/devices/pci:00/:00:1a.0/usb1/1-1/1-1.4
  │ usb:1-1.4
  │  
├─/sys/devices/pci...000:00:1a.0/usb1/1-1/1-1.4/1-1.4.1/1-1.4.1:1.0/0003:05FE:0011.0005/input/input19
  │ │ input:input19 Cypress Sem PS2/USB Browser Combo  
Mouse
  │  
├─/sys/devices/pci...000:00:1a.0/usb1/1-1/1-1.4/1-1.4.2/1-1.4.2:1.0/0003:046D:C312.0006/input/input20

  │ │ input:input20 BTC USB Multimedia Keyboard
  │  
├─/sys/devices/pci...000:00:1a.0/usb1/1-1/1-1.4/1-1.4.2/1-1.4.2:1.1/0003:046D:C312.0007/input/input21

  │ │ input:input21 BTC USB Multimedia Keyboard
  │  
├─/sys/devices/pci...000:00:1a.0/usb1/1-1/1-1.4/1-1.4.3/1-1.4.3:1.0/0003:0079:0006.0008/input/input22
  │ │ input:input22 DragonRise Inc.   Generic   USB   
Joystick  
  │ │  
├─/sys/devices/pci...0/usb1/1-1/1-1.4/1-1.4.3/1-1.4.3:1.0/0003:0079:0006.0008/input/input22/event19

  │ │ │ input:event19
  │ │  
└─/sys/devices/pci...:1a.0/usb1/1-1/1-1.4/1-1.4.3/1-1.4.3:1.0/0003:0079:0006.0008/input/input22/js0

  │ │   input:js0
  │  
└─/sys/devices/pci...000:00:1a.0/usb1/1-1/1-1.4/1-1.4.4/1-1.4.4:1.0/0003:0079:0006.0009/input/input23
  │   input:input23 DragonRise Inc.   Generic   USB   
Joystick  
  │
├─/sys/devices/pci...0/usb1/1-1/1-1.4/1-1.4.4/1-1.4.4:1.0/0003:0079:0006.0009/input/input23/event20

  │   │ input:event20
  │
└─/sys/devices/pci...:1a.0/usb1/1-1/1-1.4/1-1.4.4/1-1.4.4:1.0/0003:0079:0006.0009/input/input23/js1

  │ input:js1
  
└─/sys/devices/pci:00/:00:1e.0/:08:02.0/sound/card2
sound:card2 Live
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] joystick doesn't respect seat rule

2014-05-28 Thread Mantas Mikulėnas
So the seat assignment works fine – gdm is added to the ACL.

The problem is that the devnode is *world-readable*.

-- 
Mantas Mikulėnas graw...@gmail.com
On May 28, 2014 8:57 PM, Floris jkflo...@dds.nl wrote:

 Op Wed, 28 May 2014 19:06:22 +0200 schreef Zbigniew Jędrzejewski-Szmek 
 zbys...@in.waw.pl:

  On Wed, May 28, 2014 at 05:45:01PM +0200, Floris wrote:

 Are you logged in as the same user on both seats?
 

 Nobody is logged in on seat1

 I think the difference is that with `jstest`, the device doesn't
 interact with your seat, but *you* are interacting directly with its
 device node, so the only thing that's checked is devnode
 permissions...
 

 When I start a game on seat0 I can use the joystick attached to seat1

 What does 'getfacl /dev/input/js0' say? And 'loginctl seat-status seat1'?

 Zbyszek

  $ getfacl /dev/input/js0
 getfacl: Removing leading '/' from absolute path names
 # file: dev/input/js0
 # owner: root
 # group: root
 user::rw-
 user:Debian-gdm:rw-
 group::r--
 mask::rw-
 other::r--

 $ loginctl seat-status seat1
 seat1
 Sessions: *c1
  Devices:
   ├─/sys/devices/pci:00/:00:05.0/:02:00.0
   │ [MASTER] pci::02:00.0
   ├─/sys/devices/pci:00/:00:05.0/:02:00.1/
 sound/card1
   │ sound:card1 NVidia
   │ ├─/sys/devices/pci:00/:00:05.0/:02:00.1/
 sound/card1/input14
   │ │ input:input14 HDA NVidia HDMI/DP,pcm=7
   │ └─/sys/devices/pci:00/:00:05.0/:02:00.1/
 sound/card1/input5
   │   input:input5 HDA NVidia HDMI/DP,pcm=3
   ├─/sys/devices/pci:00/:00:1a.0/usb1/1-1/1-1.4
   │ usb:1-1.4
   │ ├─/sys/devices/pci...000:
 00:1a.0/usb1/1-1/1-1.4/1-1.4.1/1-1.4.1:1.0/0003:05FE:0011.
 0005/input/input19
   │ │ input:input19 Cypress Sem PS2/USB Browser Combo
 Mouse
   │ ├─/sys/devices/pci...000:
 00:1a.0/usb1/1-1/1-1.4/1-1.4.2/1-1.4.2:1.0/0003:046D:C312.
 0006/input/input20
   │ │ input:input20 BTC USB Multimedia Keyboard
   │ ├─/sys/devices/pci...000:
 00:1a.0/usb1/1-1/1-1.4/1-1.4.2/1-1.4.2:1.1/0003:046D:C312.
 0007/input/input21
   │ │ input:input21 BTC USB Multimedia Keyboard
   │ ├─/sys/devices/pci...000:
 00:1a.0/usb1/1-1/1-1.4/1-1.4.3/1-1.4.3:1.0/0003:0079:0006.
 0008/input/input22
   │ │ input:input22 DragonRise Inc.   Generic   USB
  Joystick  
   │ │ ├─/sys/devices/pci...0/
 usb1/1-1/1-1.4/1-1.4.3/1-1.4.3:1.0/0003:0079:0006.0008/
 input/input22/event19
   │ │ │ input:event19
   │ │ └─/sys/devices/pci...:1a.
 0/usb1/1-1/1-1.4/1-1.4.3/1-1.4.3:1.0/0003:0079:0006.0008/input/input22/js0
   │ │   input:js0
   │ └─/sys/devices/pci...000:
 00:1a.0/usb1/1-1/1-1.4/1-1.4.4/1-1.4.4:1.0/0003:0079:0006.
 0009/input/input23
   │   input:input23 DragonRise Inc.   Generic   USB
  Joystick  
   │   ├─/sys/devices/pci...0/
 usb1/1-1/1-1.4/1-1.4.4/1-1.4.4:1.0/0003:0079:0006.0009/
 input/input23/event20
   │   │ input:event20
   │   └─/sys/devices/pci...:1a.
 0/usb1/1-1/1-1.4/1-1.4.4/1-1.4.4:1.0/0003:0079:0006.0009/input/input23/js1
   │ input:js1
   └─/sys/devices/pci:00/:00:1e.0/:08:02.0/
 sound/card2
 sound:card2 Live
 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] joystick doesn't respect seat rule

2014-05-28 Thread Floris
Op Wed, 28 May 2014 20:38:17 +0200 schreef Mantas Mikulėnas  
graw...@gmail.com:




So the seat assignment works fine – gdm is added to the ACL.

The problem is that the devnode is *world-readable*.


and how can we fix this?

tia,

floris___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] joystick doesn't respect seat rule

2014-05-28 Thread Zbigniew Jędrzejewski-Szmek
On Wed, May 28, 2014 at 09:22:23PM +0200, Floris wrote:
 Op Wed, 28 May 2014 20:38:17 +0200 schreef Mantas Mikulėnas
 graw...@gmail.com:
 
 
 So the seat assignment works fine – gdm is added to the ACL.
 
 The problem is that the devnode is *world-readable*.
 
 and how can we fix this?

It has always been like this:

commit d638611c44672dea8d8a498dbe84c7d650ef2194
Author: Kay Sievers kay.siev...@vrfy.org
Date:   Fri Aug 10 12:36:59 2007 +0200

rules: add default rules

I guess that the assumption is that this is relatively safe to allow
public reading of joystick and mouse input. Kay, please correct me
if necessary.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] joystick doesn't respect seat rule

2014-05-28 Thread David Herrmann
Hi

On Wed, May 28, 2014 at 11:07 PM, Zbigniew Jędrzejewski-Szmek
zbys...@in.waw.pl wrote:
 On Wed, May 28, 2014 at 09:22:23PM +0200, Floris wrote:
 Op Wed, 28 May 2014 20:38:17 +0200 schreef Mantas Mikulėnas
 graw...@gmail.com:

 
 So the seat assignment works fine – gdm is added to the ACL.
 
 The problem is that the devnode is *world-readable*.

 and how can we fix this?

 It has always been like this:

 commit d638611c44672dea8d8a498dbe84c7d650ef2194
 Author: Kay Sievers kay.siev...@vrfy.org
 Date:   Fri Aug 10 12:36:59 2007 +0200

 rules: add default rules

 I guess that the assumption is that this is relatively safe to allow
 public reading of joystick and mouse input. Kay, please correct me
 if necessary.

Correct. joydev devices are always world-readable as games (SDL,
steam, ...) rely on the device-nodes.

There are some things to note about joydevs:
1) They are deprecated! No features are added, any new application is
advised to use evdev exclusively (event devices). Same is true for
mousedev and others. Rule of thumb is: evdev is the only node you
should use.
2) Input handling other than mouse (which includes trackpads and
touchscreens) and keyboard has never been figured out properly. There
is XInput, XInput2 and more, but games still use joydev directly. They
ignore seat assignments, they ignore permissions, they ignore evdev.
It's a mess and there is currently no solution. No, there isn't even
anyone working on it.

It's a complex task. So unless someone wants to tackle it, we have to
deal with the consequences. This includes: applications will ignore
seat-assignments for joysticks, gamepads and more.

Thanks
David
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel