你好, 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
