From: Nikolai Kondrashov <spbnick@gmail.com>
To: Jiri Kosina <jkosina@suse.cz>
Cc: Henrik Rydberg <rydberg@euromail.se>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3] hid: Enable report fixup on rebind
Date: Sun, 06 May 2012 19:54:49 +0300 [thread overview]
Message-ID: <4FA6ACD9.6010907@gmail.com> (raw)
In-Reply-To: <4FA6AC46.20701@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 298 bytes --]
On 05/06/2012 07:52 PM, Nikolai Kondrashov wrote:
> I've managed to throw together a script which rebinds a device to a specific
> out-of-tree HID driver automatically. Please find it attached. I'll be
> bundling it with the modules, probably.
Now with proper indentation, sorry.
Sincerely,
Nick
[-- Attachment #2: digimend-rebind --]
[-- Type: text/plain, Size: 2303 bytes --]
#!/bin/sh
#
# DIGImend specific driver rebinding script. To be invoked by udev.
# Author: Nikolai Kondrashov <spbnick@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Write a string to a file, ignoring ENODEV.
write_ignore_enodev() {
local str="$1"
local path="$2"
local output=""
# Write the string with tee, capturing error output
if ! output="`(echo \"$str\" | tee \"$path\" >/dev/null) 2>&1`"; then
# Raise anything except ENODEV
if [ "${output##*: }" != "No such device" ]; then
echo "$output" >&2
return 1
fi
fi
}
(
set -e -u
progname="`basename \"$0\"`"
id="`basename $DEVPATH`"
current_driver_path="`readlink -v -f /sys${DEVPATH}/driver`"
if [ -e "$current_driver_path" ]; then
current_driver="`basename \"$current_driver_path\"`"
else
current_driver=""
fi
specific_module="`modprobe -R $MODALIAS`"
# Assume the driver would be called the same as module,
# but without the "hid_" or "hid-" prefix
specific_driver="${specific_module#hid[_-]}"
specific_driver_path="/sys/bus/hid/drivers/$specific_driver"
if [ "$current_driver" != "$specific_driver" ]; then
logger -p daemon.notice -t "$progname" "rebinding $DEVPATH"
# Ensure the specific driver module is loaded
modprobe "$specific_module"
# Unbind from the current driver, if any
if [ -n "$current_driver" ]; then
write_ignore_enodev "$id" "$current_driver_path/unbind"
fi
# Bind to the specific driver
write_ignore_enodev "$id" "$specific_driver_path/bind"
fi
) 2>&1 | logger -p daemon.warning -t "$progname"
prev parent reply other threads:[~2012-05-06 16:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-22 12:21 [PATCH 0/3] hid: Enable report fixup on rebind Henrik Rydberg
2012-04-22 12:21 ` [PATCH 1/3] hid-hyperv: Do not use hid_parse_report() directly Henrik Rydberg
2012-04-27 8:53 ` Jiri Kosina
2012-04-30 20:15 ` KY Srinivasan
2012-04-22 12:21 ` [PATCH 2/3] hid-logitech: Collect report descriptors before sending Henrik Rydberg
[not found] ` <CAE7qMrqEJmBWo7JDHuB2DnWJ4vkvv9jya7RDJguiXsrs2xgadQ@mail.gmail.com>
2012-04-30 14:44 ` Benjamin Tissoires
2012-04-30 14:44 ` Benjamin Tissoires
2012-04-30 18:14 ` Henrik Rydberg
2012-04-22 12:21 ` [PATCH 3/3] hid: Handle driver-specific device descriptor in core Henrik Rydberg
2012-04-22 21:27 ` [PATCH 0/3] hid: Enable report fixup on rebind Jiri Kosina
2012-04-23 7:52 ` Nikolai Kondrashov
2012-04-29 15:33 ` Nikolai Kondrashov
2012-04-30 12:06 ` Henrik Rydberg
2012-04-30 12:06 ` Jiri Kosina
2012-04-30 12:25 ` Nikolai Kondrashov
2012-05-06 16:52 ` Nikolai Kondrashov
2012-05-06 16:54 ` Nikolai Kondrashov [this message]
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=4FA6ACD9.6010907@gmail.com \
--to=spbnick@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rydberg@euromail.se \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.