LCDproc development and user support list

Text archives Help

[Lcdproc] PATCH: Enable picolcd to pass IR codes to LIRC via UDP (redone)

Chronological Thread 
  • From: ethan.dicks at (Ethan Dicks)
  • Subject: [Lcdproc] PATCH: Enable picolcd to pass IR codes to LIRC via UDP (redone)
  • Date: Sun, 21 Sep 2008 17:33:51 +0000

On Sun, Sep 21, 2008 at 5:15 PM, Jack Cleaver <jack at> wrote:
> The claim-and-detach logic for the USB interface isn't working properly
> (for me) at bootup, because the hid driver has got the device. This used
> to work.
> It works if I change the code so the driver doesn't bail out after
> failing to set the configuration, and goes on with detaching the hid
> driver. But I can't see anything that has changed in that regard since I
> had code that worked, so I'm not uploading a patch (for now).
> I've been tinkering with my hardware. That's the only thing I can see
> that has changed since yesterday, but I can't see why that would affect
> anything.
> Is anyone else testing this?

I have been working on the picolcd driver myself, but I don't have LIRC set up
(yet), so I haven't tested that portion of things.

I personally noticed some oddnesses with the claim-and-detach logic. Working
with Nicu and stepping through the logic in usblib, I came up with an init
sequence that works for me, but I don't know that it's the "right thing to

My test environment is usblib 0.12 and a very recent nightly of LCDproc on
a RedHat Enterprise Linux desktop (2.6.9-55.0.9.ELsmp). Given that I
use RHES for work, I won't be dropping Debian or Ubuntu or anything else
on it... I have nothing against other distros (I started with Slackware over
years ago), but nobody is paying me to run anything other than RedHat right

Anyway, here's what I have _after_ the existing code that opens the
device and checks the device tree for picoLCD_VENDOR/picoLCD_DEVICE
(note that I do _not_ call usb_set_configuration() - if I do that, things
work right).

if (pd->lcd != NULL) {
debug(RPT_DEBUG, "%s: opening device succeeded", drvthis->name);

char driver[1024];
rtn = usb_get_driver_np(pd->lcd, 0, driver, sizeof(driver));
if (rtn == 0) {
report(RPT_WARNING, "Interface claimed by '%s', attempting to
detach it", driver);
rtn = usb_detach_kernel_driver_np(pd->lcd, 0);
report(RPT_WARNING, "usb_detach_kernel_driver_np() returned %d", rtn);

rtn = usb_claim_interface(pd->lcd, 0);
if (rtn != 0) {
printf("usb_claim_interface() failed, returned %d, errno %d", rtn,
return -1;

if (usb_set_altinterface(pd->lcd, 0) < 0)
report(RPT_WARNING, "%s: unable to set alternate configuration",
} else {
report(RPT_ERR, "%s: no device found", drvthis->name);
return -1;

It's pretty straightforward and it does work on my RHEL system, but one
thing that's odd... according to log messages, the first time I start up LCDd
after I've plugged in the picolcd, it tells me that the reliquishing driver is
'usbhid'... ok... great. The odd part is _after_ that, every time I start up
LCDd, until I unplug the devlce and plug it back in, I get garbage for an
owner. I would have thought that the device would be unowned after
LCDd takes it from usbhid the first time, and that usb_get_driver_np()
would return some sort of status that _nobody_ owned the picolcd, but
it appears to be not so.

If this sequence really is doing the right thing rather than just "not
on my system, I can submit a patch for that part of picolcd.c. I'm also
quite happy to test other arrangements on my system to ensure they work
in this environment.


Archive powered by MHonArc 2.6.18.

Top of page