From: C. M. <cm...@fr...> - 2006-02-22 15:53:33
|
On Tue, Feb 21, 2006 at 10:51:29PM +0100, Till Harbaum waxed: > H > > On Tuesday 21 February 2006 07:10, Michael Reinelt wrote: > > I already committed your patch to CVS. I cannot test it at the moment, > > because I'd have to dig out a display with keys... > You'll soon get one in the mail ... i have just added keypad support to the > LCD2USB driver. > > But i have a very stupid question: What is this good for? Ok, i can increment > and decrement values, but is there some useful real life example? I think it could provide for much more interactive displays like changing layouts, offering confirmation dialogs, menus, reboot, etc. Potentially helpful stuff for rackmount machines. Right now I'm making use of it with the file plugin to scroll thru dmesg output: Widget dmesg1 { class 'Text' expression file::readline('/var/log/dmesg',currline) width 20 update 250 } Widget keydown { class 'Keypad' position 'down' state 'pressed' expression currline = currline+1 } > Two more things i notices: > - i accidentally put the "Keypad1 'keyup'" line in the display part inside my > Row1 statement. This didn't work, but i didn't get a warning or error I guess I didn't realize that, but it seems to work the same with GPO lines, silently ignoring them as far as I can tell. Maybe that should change, too ? > - why does the driver use two stages? first feed some device dependant > data into the keypad driver and then have a callback that interprets this > into some keypad specific values? Why don't we just return values > the driver expects in the first place? By forcing you to write a separate translation function, the code stays cleaner, at least that was one of my thoughts behind the two-stage setup. Looking at it now, it's not really necessary and perhaps is a bit confusing. Although it feels like the driver should have some sort of callback... > - What is the purpose of the KEYPADSIZE value? (BTW: A coding style > question: Why are these variables upper case? Maybe they were constants > once, but upper case variables are quite confusing ...) I was looking at DCOLS, DROWS, etc., from the generic text widget, trying to follow that convention. But KEYPADSIZE itself is just left over cruft, and I'm taking it out now. > Anyway: I love to see lcd4linux react on my buttons :-) Super ! --Chris |