* HID_REQ_GET_REPORT and report not filled during hid_pidff_init
@ 2014-01-27 19:31 Lauri Peltonen
2014-02-20 15:14 ` Jiri Kosina
0 siblings, 1 reply; 2+ messages in thread
From: Lauri Peltonen @ 2014-01-27 19:31 UTC (permalink / raw)
To: linux-input; +Cc: jkosina
Hi.
I'm making some enhancements to hid/usbhid/hid-pidff.c to support more
force feedback devices, but I've encountered some weird behaviour. I'm
not sure whether it's a bug or something else.
My changes depend on knowing some device information (like memory) in
the initialization phase, and luckily hid-pidff reads the info from
PID_POOL report in hid_pidff_init -> pidff_reset. [1] and [2]
However, I noticed that the report struct never gets filled (all
zeros), even though with usbmon I can see the ctrl message out and the
report coming in with correct data (300 bytes of memory etc). I
managed to locate the line which causes the report to be dropped in
hid/hid-core.c , in hid_input_repor(..)t checking for
driver_input_lock. [3] Commenting out the following lines "fixes" the
issue, and the struct gets filled correctly. Anyways, I think that is
not a real solution.
if (down_trylock(&hid->driver_input_lock))
return -EBUSY;
Now, I wonder if there is a reason why the locking fails? Is the
driver locked during the initialization and hid_hw_request(...
HID_REQ_GET_REPORT) cannot be used? If that is so, what is the correct
way to read device reports during the init? And does the hid-pidff
driver ever read the pool report correctly, or is this just with my
Saitek device?
I'm using kernel 3.13.
Best regards, Lauri Peltonen
[1] http://lxr.free-electrons.com/source/drivers/hid/usbhid/hid-pidff.c#L1268
[2] http://lxr.free-electrons.com/source/drivers/hid/usbhid/hid-pidff.c#L1172
[3] http://lxr.free-electrons.com/source/drivers/hid/hid-core.c#L1392
--
Lauri Peltonen
lauri.peltonen@gmail.com
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: HID_REQ_GET_REPORT and report not filled during hid_pidff_init
2014-01-27 19:31 HID_REQ_GET_REPORT and report not filled during hid_pidff_init Lauri Peltonen
@ 2014-02-20 15:14 ` Jiri Kosina
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2014-02-20 15:14 UTC (permalink / raw)
To: Lauri Peltonen; +Cc: linux-input
On Mon, 27 Jan 2014, Lauri Peltonen wrote:
> I'm making some enhancements to hid/usbhid/hid-pidff.c to support more
> force feedback devices, but I've encountered some weird behaviour. I'm
> not sure whether it's a bug or something else.
>
> My changes depend on knowing some device information (like memory) in
> the initialization phase, and luckily hid-pidff reads the info from
> PID_POOL report in hid_pidff_init -> pidff_reset. [1] and [2]
>
> However, I noticed that the report struct never gets filled (all
> zeros), even though with usbmon I can see the ctrl message out and the
> report coming in with correct data (300 bytes of memory etc). I
> managed to locate the line which causes the report to be dropped in
> hid/hid-core.c , in hid_input_repor(..)t checking for
> driver_input_lock. [3] Commenting out the following lines "fixes" the
> issue, and the struct gets filled correctly. Anyways, I think that is
> not a real solution.
>
> if (down_trylock(&hid->driver_input_lock))
> return -EBUSY;
>
> Now, I wonder if there is a reason why the locking fails? Is the
> driver locked during the initialization and hid_hw_request(...
> HID_REQ_GET_REPORT) cannot be used?
Hi Lauri,
yes, that is the case. For the reasoning, and quite some more background
explanation of how this whole thing works, please read changelog of commit
4ea5454203d ("HID: Fix race condition between driver core and ll-driver").
Hopefully that should clarify your questions. If not, just ask :)
--
Jiri Kosina
SUSE Labs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-02-20 15:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-27 19:31 HID_REQ_GET_REPORT and report not filled during hid_pidff_init Lauri Peltonen
2014-02-20 15:14 ` Jiri Kosina
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).