LCD Support in kernel

Tim Pushor timp at crossthread.com
Wed Sep 15 15:17:26 PDT 2004


Henrik W Lund wrote:

>>
>> I am planning on purchasing a crystalfontz LCD panel to be able to 
>> have a rudimentary interface with the system without having a 
>> keyboard/monitor/shell.
>>
>> I'm not sure whether to go the serial or USB route. What I want to do 
>> is to be able to display status as the system is coming up, then have 
>> a user level application accept input from the panel and display 
>> various statistics, then when the system is brought down, for the 
>> panel to notify the user that it is safe to turn off the machine.
>>
>> For the startup and shutdown I would need to hack stuff into the 
>> kernel. I have done a fair bit of C programming over the years, but 
>> never worked in the kernel. So I have 2 real questions:
>>
>> Would it be easier to control the USB or Serial panel from the Kernel?
>> And - does anyone have any recommendations as to where I could even 
>> start looking in the kernel to do what I want?
>>
>> Thanks,
>> Tim
>>
>> (Please CC: me as I am not subscribed to this list - Thanks!) 
>
>
> Greetings!
>
> I'd guess that the serial version would be the way to go, since 
> FreeBSD has builtin support for displaying to serial console 
> (typically used for headless systems, allowing admins to use a serial 
> communications program like HyperTerminal under Windows for out- and 
> input). This is, of course, assuming that the LCD panel interfaces 
> like a serial terminal. If it does, you've got about half the job 
> done, as FreeBSD will happily print bootup and shutdown information 
> out-of-the-box.
>
Well, I was *hoping* to be able to display my own messages to the 
display. I suppose I should have explained a little better - the display 
is a 2 line x 16 character display, so the output from the kernel 
startup would probably just be a blur ;-) It may even be difficult to 
determine where it is hanging if it were to hang (due to the small size 
and information capacity).

> Further, if it announces touches to the screen as regular keypresses, 
> you're even luckier. All that really would remain for you to do was to 
> write the UI (as I don't think a ready-made solution exists for what 
> you want. I may be wrong, though). If this is to be a GUI (on top of 
> X, that is), you'd have to find out if X will display to serial 
> terminal. If it doesn't, I'm sure any idea you can come up with is 
> just as good/better than mine. ;-)
>
The display actually fits iniside a 5 1/4" drive bay, and the 
pushbuttons do not emulate a keyboard. I am not to worried about it, 
however, as I don't really need to be able to read the keypad during the 
startup and shutdown process.

> Worst case scenario; the LCD screen interfaces like a toaster. My best 
> bet would be to do a kernel module. More info on how to do those can 
> be found here:
>
> http://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/index.html
>
Thanks for the link - I will be sure to go through everything there. I 
*have* written device drivers for other operating systems and done a 
fair bit of interface code in C in the past.

If it is possible, I would prefer to use the USB model, but that would 
require me homehow figuring out how to use the device drivers from my 
kernel module. A cursory look through the Architecture Handbook doesn't 
cover that (the USB device driver for the lcd panel in question already 
does exist in FreeBSD).

I would also have to make sure that the USB subsystem (and probably the 
serial devices as AFAICT the USB driver for the lcd looks like a serial 
port to applications) was loaded as early on as I could so I could use 
it for most of the FreeBSD startup - and what about the shutdown? Will 
the device exist and work when the kernel is in the 'halted' state?

I have thought about the possibility of talking directly to the serial 
port (I have done 16*50 interface code before) during my serial module, 
but that may open another can of worms.

> I encourage others to elaborate (and correct me, of course) as they 
> see fit. Not having done much actual work on FreeBSD myself, what I 
> propose here is what my programmer's mind sees as probable based on 
> what documentation and experimenting I have seen and done.

Thanks Henrik, I apprecate the response ;-)



More information about the freebsd-questions mailing list