linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lauri Peltonen <lauri.peltonen@gmail.com>
To: linux-input@vger.kernel.org
Cc: jkosina@suse.cz
Subject: HID_REQ_GET_REPORT and report not filled during hid_pidff_init
Date: Mon, 27 Jan 2014 21:31:53 +0200	[thread overview]
Message-ID: <CAMvWtwT_J7rL1yFXZ3PyK1EEmmd=z3CgRUtQcgG+Yeh1tcWNrg@mail.gmail.com> (raw)

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

             reply	other threads:[~2014-01-27 19:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 19:31 Lauri Peltonen [this message]
2014-02-20 15:14 ` HID_REQ_GET_REPORT and report not filled during hid_pidff_init Jiri Kosina

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='CAMvWtwT_J7rL1yFXZ3PyK1EEmmd=z3CgRUtQcgG+Yeh1tcWNrg@mail.gmail.com' \
    --to=lauri.peltonen@gmail.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.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).