From: Li Yu <raise.sail@gmail.com>
To: Jiri Kosina <jkosina@suse.cz>
Cc: Dmitry Torokhov <dtor@insightbb.com>,
yanghong@ccoss.com.cn,
linux-usb-devel <linux-usb-devel@lists.sourceforge.net>,
hongzhiyi@ccoss.com.cn, Marcel Holtmann <marcel@holtmann.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [linux-usb-devel] [RFC] HID bus design overview.
Date: Mon, 02 Apr 2007 09:47:08 +0800 [thread overview]
Message-ID: <4610609C.9030101@gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0704010002280.6040@jikos.suse.cz>
Jiri Kosina wrote:
> On Fri, 30 Mar 2007, Dmitry Torokhov wrote:
>
>
>> There should be one device and your driver should simply do:
>> static void my_driver_hid_event(struct hid_device *hid, struct hid_field *field,
>> struct hid_usage *usage, __s32 value)
>> {
>> if (special_processing_needed(usage)) {
>> do_special_processing(...);
>> input_event(field->hidinput->input, XXX, YYY, ZZZ);
>> ...
>>
>> } else
>> hidinput_hid_event(hid, field, usage, value);
>> }
>>
>
> Hi,
>
> in fact I am not entirely sure that the specialized drivers hooked to the
> HID bus should be passed individual fields/usages by the generic HID
> driver. That would imply that generic HID layer would have to parse the
> received report using information retrieved from the report descriptor of
> the device. But this is in some way in contrary to one of the features
> this effort should be heading to, isn't it? We want to provide means how
> to bypass possible errors in HID descriptor of the device (or do any other
> possible quirky handling) - we want to be able to allow for completely
> different interpretation of fields than the generic HID parser would do,
> right?
>
> So I guess the above should rather be
>
> static void my_driver_hid_report(struct hid_device *hid, u8 *data,
> int size)
> {
> if (special_processing_needed(data)) {
> do_special_processing(...);
> input_event(field->hidinput->input, XXX, YYY, ZZZ);
> ...
> } else
> hid_input_report(hid, data, size);
> }
>
>
> Such driver will register itself onto a HID bus. Both USB and BT
> transports could provide VID and PID which could then be easily matched
> against by the bus code to easily check whether processing by specialized
> driver is needed or handling by (existing) generic HID layer is enough.
>
> As an added value, hooking the hidraw code to this architecture would then
> be rather a trivial task.
>
> Thanks,
>
>
Let me explain the internal of my current HID bus implementation. I
think that selecting one user scene as example is good idea.
Well, the user A plug a USB joystick into computer. The work processing
of HID subsystem for this joystick is same with our mind: The USB/base
driver works for it. However, the world is not faultless. This joystick
is buggy, its some keys need specific handling, our good friend udev
discover that there is also have another driver can handle it, so it
insert that kernel module, then our sweet leading role specific/shadow
HID driver appear on scene. Registering shadow driver let HID core clone
a hid_device first, and start new usage configuration processing for new
cloned hid_device (if we like, even I think we can reread reports from
physical device), the shadow driver can join with HID core to
custom/hook in this recofiguration processing. If this shadow driver is
input-able, the HID core will unregister working input device come from
USB/base hid_device, and register new input device for this shadow
hid_device. So we have not two input_dev for one HID device at same time.
When user A remove this shadow driver, the USB/base driver should resume
work for this joystick, IOW, it should register back its input device again.
There have another type driver: the sticky driver, they will attach each
working device without clone or create new hid_device or input_dev. the
example is hiddev and hidraw.
Yes, this model imply there need more uevents: add, remove. Is this
model suitable? I think the essence of our discussion is how to handle
unknown abnormal device.
I had already ported this to 2.6.21-rc5-mm2, and spent almost two days
to find out one concurrency problem. I lucky known where have bug, but
not fixed it.
Good luck.
- Li Yu
next prev parent reply other threads:[~2007-04-02 1:48 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-05 7:32 [DOC] The documentation for HID Simple Driver Interface 0.5.0 Li Yu
2007-03-05 20:44 ` Marcel Holtmann
2007-03-05 20:11 ` Dmitry Torokhov
2007-03-05 22:40 ` Marcel Holtmann
2007-03-06 13:25 ` Dmitry Torokhov
2007-03-06 13:47 ` Jiri Kosina
2007-03-06 18:57 ` Marcel Holtmann
2007-03-05 21:47 ` Jiri Kosina
2007-03-05 22:12 ` [linux-usb-devel] " Jiri Kosina
2007-03-05 22:27 ` Dmitry Torokhov
2007-03-06 1:37 ` Liyu
[not found] ` <45ECC5A4.20203@ccoss.com.cn>
2007-03-06 9:40 ` Jiri Kosina
2007-03-06 11:52 ` Harold Sargeant
2007-03-06 7:01 ` Robert Marquardt
2007-03-06 7:37 ` Jiri Kosina
2007-03-19 10:44 ` [RFC] HID bus design overview Li Yu
2007-03-26 8:27 ` [linux-usb-devel] " Marcel Holtmann
2007-03-28 1:58 ` Li Yu
[not found] ` <4609CAF2.3040303@ccoss.com.cn>
2007-03-28 7:51 ` Jiri Kosina
2007-03-28 19:00 ` Dmitry Torokhov
2007-03-28 19:13 ` Jiri Kosina
2007-03-30 3:06 ` Li Yu
2007-03-30 4:33 ` Dmitry Torokhov
2007-03-30 5:37 ` Li Yu
2007-03-30 16:13 ` Dmitry Torokhov
2007-03-31 22:49 ` Jiri Kosina
2007-04-02 1:47 ` Li Yu [this message]
2007-04-02 4:15 ` Dmitry Torokhov
2007-04-02 7:07 ` Li Yu
2007-04-02 7:42 ` Greg KH
2007-04-02 9:34 ` Jiri Kosina
2007-04-02 12:40 ` Dmitry Torokhov
2007-04-02 4:09 ` Dmitry Torokhov
2007-04-02 9:37 ` Jiri Kosina
2007-04-02 10:14 ` Robert Marquardt
2007-04-02 12:21 ` Marcel Holtmann
2007-04-02 12:33 ` Jiri Kosina
2007-04-02 16:47 ` Marcel Holtmann
2007-04-03 1:15 ` Li Yu
2007-04-03 3:42 ` Dmitry Torokhov
2007-04-03 8:57 ` Jiri Kosina
2007-04-04 0:55 ` Li Yu
2007-04-04 14:54 ` Marcel Holtmann
2007-04-04 23:01 ` Adam Kropelin
2007-04-04 23:12 ` Jiri Kosina
2007-04-04 23:34 ` Adam Kropelin
2007-04-05 8:36 ` Jiri Kosina
2007-04-05 14:08 ` Adam Kropelin
[not found] ` <46189FE3.6050206@gmail.com>
2007-04-09 1:54 ` [linux-usb-devel] HID bus prototype - 20070408 Li Yu
2007-04-10 9:40 ` Jiri Kosina
2007-04-10 11:00 ` [linux-usb-devel] " Li Yu
2007-04-05 1:25 ` [linux-usb-devel] [RFC] HID bus design overview Li Yu
2007-04-05 3:09 ` Dmitry Torokhov
2007-04-05 5:28 ` Li Yu
2007-04-05 6:47 ` Li Yu
2007-04-06 0:58 ` Li Yu
2007-03-29 5:37 ` Li Yu
2007-03-29 9:24 ` Jiri Kosina
2007-04-02 12:19 ` Marcel Holtmann
-- strict thread matches above, loose matches on Subject: below --
2007-04-02 11:57 Nicolas Mailhot
2007-04-03 1:40 ` Li Yu
2007-04-03 3:41 ` Dmitry Torokhov
2007-04-03 9:00 ` Jiri Kosina
2007-04-05 18:10 ` Paul Walmsley
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=4610609C.9030101@gmail.com \
--to=raise.sail@gmail.com \
--cc=dtor@insightbb.com \
--cc=hongzhiyi@ccoss.com.cn \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
--cc=marcel@holtmann.org \
--cc=yanghong@ccoss.com.cn \
/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