Re: picoLCD improved key input

Martin T Jones <[email protected]> Mon, 14 Nov 2011 16:11:19 +0000
Newsgroups gmane.comp.sysutils.lcdproc
Message-ID <[email protected]>
Hello,

Sorry for the delay replying I've been on holiday.

On 05/11/11 20:40, Markus Dolze wrote:
> Hello Martin,
>
> attached you find my version of your patch. Please patch against cvs HEAD.
>
> The main differences between your first version and this one:
>
> - Library (de)initialization is session based. This allows us to
> restrict libusb-1.0 to this driver without affecting other (future)
> drivers and LCDd core.
>    
Moving polling and processing for libusb to the drivers that use 
libusb-1.0 spreads the event handling code through several files (the 
socket and time events are already in different files). I would prefer 
to see it all in one place. Using a libusb context in the picoLCD driver 
provides a template that future drivers that want to use asynchronous 
usb communication may copy. This is moving further away from what I 
consider the optimum implementation, a single select statement with 
non-zero timeout.

> - Key repeat is calculated based on actual time values instead of
> countdown loops. This makes the code independent from the processing
> intervals.
>    
I chose to use countdowns for efficiency, you still need to know the 
processing interval to prevents repeat keys being generated faster than 
they can be processed (at least it was needed for my version). I shall 
have to test both options.
> - Repeat values are restricted to 0-3000ms (arbitrarily chosen) with 0
> disabling it.
>    
Probably wise to restrict to a sensible range.
> - picolcd_close frees more memory previously allocated.
>    
Need to cancel any transfer before freeing its buffer, a bit tricky 
because the main loop is not running while devices are closing but it 
should be possible to ensure that the transfer call-back is called.
> The libusb-1.0 implementation compiles surprisingly well on FreeBSD if I
> only were able to find out about how to make configure work. This system
> comes with an USB library compatible with libusb-0.1 _and_ libusb-1.0,
> but lacks any way of detecting it with pkg-config. I spent the whole
> afternoon fiddling with it and ended up hard-coding the values for my
> system within configure.in (this is missing from the attached patch).
>
> Please give it a try. I coded blindly - it compiles but I have no idea
> how it behaves with a real display.
>
> Regards,
> Markus
>
>    
It may be a while before I can try a new version, I have lots to do at 
the moment.

Regards,

Martin