Re: Sharp CE-RH2 remote kernel driver

"Justin Patrin" <[email protected]>
Newsgroups gmane.comp.handhelds.openzaurus.devel,gmane.comp.handhelds.linux.kernel
Message-ID <[email protected]>
On 1/18/07, Richard Purdie <[email protected]> wrote:
> On Thu, 2007-01-18 at 12:31 -0800, Justin Patrin wrote:
> > I finally got another hint and have a working kernel driver for the
> > CE-RH2 in-line audio remote. It outputs the correct keys. Both xev and
> > showkey only show 3 of the keys, the other 4 show some strange output.
>
> Any idea why? I presume the kernel is doing the right thing and that's
> some kind of userspace issue?
>

Not really. xev shows:
17:20:03.903 KeyPress event, serial 24, synthetic NO, window 0x2c00001,
    root 0x3b, subw 0x0, time 938499390, (372,323), root:(376,343),
    state 0x0, keycode 122 (keysym 0xffcb, F14), same_screen YES,
    XLookupString gives 0 bytes:

17:20:04.052 KeyRelease event, serial 24, synthetic NO, window 0x2c00001,
    root 0x3b, subw 0x0, time 938499539, (372,323), root:(376,343),
    state 0x0, keycode 122 (keysym 0xffcb, F14), same_screen YES,
    XLookupString gives 0 bytes:

for a key that "works" (volume down) and:

17:20:04.933 KeyPress event, serial 24, synthetic NO, window 0x2c00001,
    root 0x3b, subw 0x0, time 938500420, (372,323), root:(376,343),
    state 0x0, keycode 8 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 1 bytes: (00) ""

17:20:05.012 KeyRelease event, serial 24, synthetic NO, window 0x2c00001,
    root 0x3b, subw 0x0, time 938500499, (372,323), root:(376,343),
    state 0x0, keycode 8 (keysym 0x0, NoSymbol), same_screen YES,
    XLookupString gives 1 bytes: (00) ""

for Play/Pause, Next, Prev, and Stop. The other 2 (vol up, mute) show
their own keycodes, 123 and 121. The only difference I see for the 4
"8" ones is that XLookupString gives 1 null byte for those.

showkey shows:
keycode 114 press
keycode 114 release
keycode 115 press
keycode 115 release
keycode 113 press
keycode 113 release

for vol up/down/mute and:

keycode   0 press
keycode   1 release
keycode  36 release
keycode   0 release
keycode   1 release
keycode  36 release
keycode   0 press
keycode   1 release
keycode  35 release
keycode   0 release
keycode   1 release
keycode  35 release
keycode   0 press
keycode   1 release
keycode  37 release
keycode   0 release
keycode   1 release
keycode  37 release
keycode   0 press
keycode   1 release
keycode  38 release
keycode   0 release
keycode   1 release
keycode  38 release

for play, next, prev, stop. It is giving different "3x" codes for each
but also gives a 0 and 1 at the same time which is strange...

> > However, gizmod (compiled on the Z due to cross-compile problems) sees
> > all 7 keys just fine and some quick hacking has it controlling mpd for
> > me (although volume control is still complicated).
>
> Still complicated?

Volume control in the Mixer Applet (GPE) and in mpd do nothing.
alsamixer continues to work fine. It has been this way since sound
started working on the spitz. It would be nice if other programs could
be allowed to control the volume.

I'm currently planning on doing some quick regexes to change the
volume through alsactl and the state file but this seems like a big
hack.

>
> > There are still some issues with it, of course, it was pretty much
> > copied from the 2.4 kernel and will need some fix-ups to be merged
> > upstream but I'm willing to work on it if I can get some pointers.
> >
> > There is a problem with the IRQ handling as well as I see this in dmesg:
> > enable_irq(45) unbalanced from bf1483e0
>
> Keep in mind the effects of enable_irq and disable_irq are cumulative
> i.e. if you call disable_irq 4 times, you have to call enable_irq 4
> times too. It may well be better to leave the interrupt handler enabled
> all the time, I'm undecided...
>

*nod*, I'll see if I can figure out what's going on there.

>
> > Any help in making this patch better would be appreciated.
>
> I've inlined the code below and commented LKML style...
>

I'll check this all out and see what I can do. Thanks for you help. :-)
[snip]

> Obviously, after these cleanups there are more to deal such as cleaning
> up the logic of that state code (timer function) but this should be
> enough to be getting on with ;-).
>

Of course. This is all basically copied form embeddix, so I know it
will take some work. ;-)

-- 
Justin Patrin

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.