Solved Access right usb controller

Hi,
when I plug in my controller, a /dev/input/event12 is created for example.
With permissions:

crw------- 1 root wheel 0xca Nov 4 22:21 event12

So that I can have the rights to the controller I must do:


# chmod 640 /dev/input/event12

I would like it to happen automatically when I plug it in.
I tried to create a file:

/usr/local/etc/devd/n64gamepad.conf which contains:
Code:
#N64 gamepad

notify 100 {        
 match "system" "USB";        
 match "subsystem" "INTERFACE";        
 match "type" "ATTACH";        
 match "vendor" "0x0f0d";        
 match "product" "0x00c1";        
 action "chmod 640 $cdev";
};

But nothing happens, no modification of rights.
Someone would have any idea ?

THANKS.
 
Last edited:
Did you restart devd(8)? Then unplug and plug the device. The action is only activated when the device is getting attached, i.e. plugged in. If it's still not working show the output of usbconfig with the device plugged in.
 
yes I restarted "devd" then unplugged and reconnected the controller, still no rights.

Code:
# usbconfig -d ugen2.6 -v
ugen2.6: <SWITCH CO.,LTD. Pro Controller> at usbus2, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (500mA)
ugen2.6.0: usbhid1: <SWITCH CO.,LTD. Pro Controller, class 0/0, rev 2.00/5.72, addr 5>

  bLength = 0x0012 
  bDescriptorType = 0x0001 
  bcdUSB = 0x0200 
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000 
  bDeviceProtocol = 0x0000 
  bMaxPacketSize0 = 0x0040 
  idVendor = 0x0f0d 
  idProduct = 0x00c1 
  bcdDevice = 0x0572 
  iManufacturer = 0x0001  <SWITCH CO.,LTD.>
  iProduct = 0x0002  <Pro Controller>
  iSerialNumber = 0x0003  <AZ-RB-N64P-215 H0>
  bNumConfigurations = 0x0001 


 Configuration index 0

    bLength = 0x0009 
    bDescriptorType = 0x0002 
    wTotalLength = 0x0029 
    bNumInterfaces = 0x0001 
    bConfigurationValue = 0x0001 
    iConfiguration = 0x0000  <no string>
    bmAttributes = 0x0080 
    bMaxPower = 0x00fa 

    Interface 0
      bLength = 0x0009 
      bDescriptorType = 0x0004 
      bInterfaceNumber = 0x0000 
      bAlternateSetting = 0x0000 
      bNumEndpoints = 0x0002 
      bInterfaceClass = 0x0003  <HID device>
      bInterfaceSubClass = 0x0000 
      bInterfaceProtocol = 0x0000 
      iInterface = 0x0000  <no string>

      Additional Descriptor

      bLength = 0x09
      bDescriptorType = 0x21
      bDescriptorSubType = 0x10
       RAW dump: 
       0x00 | 0x09, 0x21, 0x10, 0x01, 0x00, 0x01, 0x22, 0x50, 
       0x08 | 0x00

     Endpoint 0
        bLength = 0x0007 
        bDescriptorType = 0x0005 
        bEndpointAddress = 0x0002  <OUT>
        bmAttributes = 0x0003  <INTERRUPT>
        wMaxPacketSize = 0x0040 
        bInterval = 0x0005 
        bRefresh = 0x0000 
        bSynchAddress = 0x0000 

     Endpoint 1
        bLength = 0x0007 
        bDescriptorType = 0x0005 
        bEndpointAddress = 0x0081  <IN>
        bmAttributes = 0x0003  <INTERRUPT>
        wMaxPacketSize = 0x0040 
        bInterval = 0x0005 
        bRefresh = 0x0000 
        bSynchAddress = 0x0000
 
The configuration changes the permissions on the corresponding /dev/usb/ device, not the /dev/input/ devices.

You can change those with /etc/devfs.rules:
Code:
[localrules=10]
  add path 'input' mode 0755 group operator
  add path 'input/*' mode 0660 group operator
And set the correct rules: sysrc devfs_system_ruleset="localrules"

I personally use the operator group, not wheel for this.

Setting I use for a specific joystick:
Code:
% cat /usr/local/etc/devd/dashine.conf
notify 100 {
  match "system"        "USB";
  match "subsystem"     "INTERFACE";
  match "type"          "ATTACH";
  match "vendor"        "0x045e";
  match "product"       "0x028e";
  action "chgrp operator /dev/$cdev; chmod 660 /dev/$cdev";
 
THANKS for the tip

my user is already in the group wheel for the "su" command to work.

I changed :

/etc/devfs.rules
Code:
[localrules=10]
  add path 'input/*' mode 0640
I just need read permission.
No conf file for devd, the controller works.
 
Back
Top