If you're trying to support an input device in DirectFB, you should
make an input driver. The original suggestion to look at the keyboard
driver is not to modify DFB code, rather use it to understand how to
make a driver (and potentially also as starter code) so that you can
write your own input driver for your device. You can also see
Makefile.am to understand that it will be installed as a shared
library in /usr/lib/directfb-0.9.25/inputdrivers. You can build and
maintain your driver separately from DirectFB since the input core
will load your driver along with all the other ones in that directory
at runtime.
/TomB
On May 15, 2006, at 6:24 AM, Lu yunfeng wrote:
> Tom,
>
> your suggestion is OK. but to write a driver is difficult to some
> degree.
>
> now I have a new idea to solve my problem
>
> A) in the main thread:
> 1)create a event buffer 'eventBuffer' with CreateEventBuffer
> ( notice , not to create event input buffer
> 2)do a while loop:
> while {1) {
> eventBuffer->WaitForEvent(eventBuffer);
> eventBuffer->GetEvent(eventBuffer, &event);
> }
>
> B) in the UART input thread
> 1) get a byte from the UART hardware
> 2) call function
> PostEvent(eventBuffer,uart_event);
> where uartevent is made of with the result of step 1.
>
> I feel this method doe not modify the DirectFB code!!!!!
> Am I right?
> Please give me your comments.
>
> Regards,
> Yunfeng
>
>
> ----- Original Message -----
> From: "Tom Bridgwater" <[EMAIL PROTECTED]>
> To: "Lu yunfeng" <[EMAIL PROTECTED]>; "DirectFB-Dev" <directfb-
> [EMAIL PROTECTED]>
> Sent: Monday, May 15, 2006 11:51 AM
> Subject: Re: [directfb-dev] how to write a DirectFb driver
>
>
>> 你好,
>>
>> Have a look in the DFB sources under inputdrivers/keyboard/keyboard.c
>> for some reference code. The driver works with the "magic"
>> DFB_INPUT_DRIVER(keyboard) macro at the top that sets up a data
>> structure full of pointers to five static functions in the same file
>> with the names like driver_xxx() that will be called by the DFB input
>> core:
>>
>> driver_get_available() - tells the input core whether or not to use
>> this driver
>> driver_get_info() - tells the input core some meta information about
>> the driver
>> driver_open_device() - where the driver initializes itself
>> driver_get_keymap_entry() - converts a DIKI_XXX constant to a
>> DIKS_XXX constant and sets DILS_XXX flags
>> driver_close_device() - where the driver shuts down and frees all
>> resources
>>
>> During initialization the driver will need to open the serial port
>> (or whatever channel it uses to communicate with the hardware) and
>> create a thread to read from the hardware, and then it returns some
>> information to the input core about its capabilities. The driver_data
>> is for the driver to store a pointer to a data structure holding its
>> private data, which is passed back to the other four driver calls
>> from the input core.
>>
>> In the driver's input thread it does whatever it needs to according
>> to the hardware's protocols, and as keys are pressed/released it
>> sends events to the input core with dfb_input_dispatch().
>>
>> 祝你順利
>> /TomB
>>
>> On May 14, 2006, at 6:53 PM, Lu yunfeng wrote:
>>
>>> Dear all,
>>>
>>> 1) I have remote control which is connect to the embedded target
>>> through UART2.
>>>
>>> 2)I wish the output of UART2 as the normal keyboard input event of
>>> DirectFB.
>>>
>>> 3) someone suggests me that a driver for UART2 should be
>>> programmed. however I do not know how to write a driver for
>>> DirectFB.
>>>
>>> can anyone know how to program a driver for UART2? who can send me
>>> some documentation about DirectFB driver programming or a demo
>>> driver sample source code?
>>>
>>> Regards,
>>> Yunfeng
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> directfb-dev mailing list
>>> [email protected]
>>> http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev
>>
>>
>> _______________________________________________
>> directfb-dev mailing list
>> [email protected]
>> http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev