Handle device events
Device insertion callback
The insertion callback, hid_insertion() function in joystick_demo.c of the demo driver, gets called when the identified device gets inserted. It performs the following typical actions:
Find reports you’re interested in (hidd_get_collections(), hidd_collection_usage(), hidd_get_report_instance())
Get information about the report (hidd_report_len(), hidd_num_buttons())
Attach to reports (hidd_report_attach())
The joystick_demo.c file is located in hiddi.h, which is present in your SDP installation for data structure and function declarations.
Device removal callback
The removal callback gets called when the identified device is removed from the system. Use hidd_reports_detach() to unregister from reports for a device in the removal callback, or if you're no longer interested in the device. You can also set up signal handling to clean up resources on process termination. Refer to the hid_removal() and joystick_demo_signal_handler() function in joystick_demo.c of the demo driver for details.