kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: is there a reason "usbhid.quirks" parameter is not root writable?
Date: Thu, 12 Nov 2015 16:44:35 -0800	[thread overview]
Message-ID: <20151113004435.GA25513@kroah.com> (raw)
In-Reply-To: <alpine.LFD.2.20.1511120306320.4937@localhost>

On Thu, Nov 12, 2015 at 03:15:41AM -0700, Robert P. J. Day wrote:
> 
>   short form: is there some reason that the usbhid "quirks" parameter
> is not by default compiled to be writable in case you wanted to adjust
> those values on a running system?
> 
>   long form: i have a USB device that, sadly, is automatically claimed
> by the usbhid driver upon insertion, and i want to prevent that so it
> behaves as a regular USB device. from what i've read, the solution is
> to, at boot time, add the kernel command line parameter:
> 
>   usbhid.quirks=0x2123:0x1010:0x04
> 
> that's fine if i want to reboot so that that takes effect, but it
> would of course be convenient if i could add that info to
> /sys/module/usbhid/parameters/quirks at run-time. currently, on my
> fedora 22 system:
> 
> $ cat /sys/module/usbhid/parameters/quirks
> (null),(null),(null),(null)
> $
> 
> with permissions:
> 
> $ ls -l /sys/module/usbhid/parameters/quirks
> -r--r--r--. 1 root root 4096 Nov 12 02:41 /sys/module/usbhid/parameters/quirks
> $
> 
> and i can see in drivers/hid/usbhid/hid-core.c the fact that that
> array is defined as non-writable:
> 
> /* Quirks specified at module load time */
> static char *quirks_param[MAX_USBHID_BOOT_QUIRKS];
> module_param_array_named(quirks, quirks_param, charp, NULL, 0444);
> MODULE_PARM_DESC(quirks, "Add/modify USB HID quirks by specifying "
>                 " quirks=vendorID:productID:quirks"
>                 " where vendorID, productID, and quirks are all in"
>                 " 0x-prefixed hex");
> 
> so the obvious(?) question is, is there some reason that that
> parameter is defined as read-only rather than, say, writable by root?
> would it not be useful to be able to modify that parameter at
> run-time? or is there something about that parameter for which that
> would be a really bad idea?

You can add a runtime quirk to the device itself when it shows up in
sysfs for the hid driver.  Use that instead of the module parameter for
that specific device.

hope this helps,

greg k-h

  reply	other threads:[~2015-11-13  0:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12 10:15 is there a reason "usbhid.quirks" parameter is not root writable? Robert P. J. Day
2015-11-13  0:44 ` Greg KH [this message]
2015-11-13  1:02   ` Valdis.Kletnieks at vt.edu
2015-11-13  1:31     ` Greg KH
2015-11-13  7:53   ` Robert P. J. Day
2015-11-13  8:11     ` Bjørn Mork
2015-11-13  8:24       ` Robert P. J. Day

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151113004435.GA25513@kroah.com \
    --to=greg@kroah.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).