예제 #1
0
GamepadsEfl::GamepadsEfl(size_t length)
    : m_slots(length)
    , m_gamepadsWatcher(0)
{
    if (eeze_init() < 0) {
        LOG_ERROR("Failed to initialize eeze library.");
        return;
    }

    // Watch for gamepads additions / removals.
    m_gamepadsWatcher = eeze_udev_watch_add(EEZE_UDEV_TYPE_JOYSTICK, (EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE), onGamePadChange, this);

    // List available gamepads.
    Eina_List* gamepads = eeze_udev_find_by_type(EEZE_UDEV_TYPE_JOYSTICK, 0);
    void* data;
    EINA_LIST_FREE(gamepads, data) {
        char* syspath = static_cast<char*>(data);
        registerDevice(String::fromUTF8(syspath));
        eina_stringshare_del(syspath);
    }
예제 #2
0
파일: eeze_suite.c 프로젝트: jigpu/efl
END_TEST

START_TEST(eeze_test_udev_watch)
{
   Eeze_Udev_Watch *watch;

   ecore_init();
   eeze_init();

   /* watch never gets triggered as this is run without user interaction */
   watch = eeze_udev_watch_add(EEZE_UDEV_TYPE_KEYBOARD, (EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE), catch_events, NULL);
   watch = eeze_udev_watch_add(EEZE_UDEV_TYPE_DRIVE_INTERNAL, (EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE), catch_events, NULL);
   watch = eeze_udev_watch_add(EEZE_UDEV_TYPE_POWER_AC, (EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE), catch_events, NULL);
   watch = eeze_udev_watch_add(EEZE_UDEV_TYPE_NET, (EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE), catch_events, NULL);
   watch = eeze_udev_watch_add(EEZE_UDEV_TYPE_IS_IT_HOT_OR_IS_IT_COLD_SENSOR, (EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE), catch_events, NULL);
   watch = eeze_udev_watch_add(EEZE_UDEV_TYPE_V4L, (EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE), catch_events, NULL);
   watch = eeze_udev_watch_add(EEZE_UDEV_TYPE_BLUETOOTH, (EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE), catch_events, NULL);
   watch = eeze_udev_watch_add(EEZE_UDEV_TYPE_NONE, (EEZE_UDEV_EVENT_ADD | EEZE_UDEV_EVENT_REMOVE), catch_events, NULL);
   eeze_udev_watch_del(watch);

   eeze_shutdown();
   ecore_shutdown();
}
예제 #3
0
void 
e_mod_kbd_device_init(void) 
{
   /* load the 'ignored' keyboard file */
   _e_mod_kbd_device_ignore_load();
#ifdef HAVE_EEZE
   eeze_init();
   watch = eeze_udev_watch_add(EEZE_UDEV_TYPE_KEYBOARD, EEZE_UDEV_EVENT_NONE,
			    _e_mod_kbd_device_udev_event, NULL);
#else
   e_dbus_init();
   e_hal_init();
   /* try to attach to the system dbus */
   if (!(_dbus_conn = e_dbus_bus_get(DBUS_BUS_SYSTEM))) return;

   /* ask HAL for any input keyboards */
   e_hal_manager_find_device_by_capability(_dbus_conn, "input.keyboard", 
                                           _e_mod_kbd_device_cb_input_kbd, NULL);

   /* setup dbus signal handlers for when a device gets added/removed/changed */
   _dev_add = 
     e_dbus_signal_handler_add(_dbus_conn, E_HAL_SENDER, 
                               E_HAL_MANAGER_PATH, 
                               E_HAL_MANAGER_INTERFACE, 
                               "DeviceAdded", _e_mod_kbd_device_dbus_add, NULL);
   _dev_del = 
     e_dbus_signal_handler_add(_dbus_conn, E_HAL_SENDER, 
                               E_HAL_MANAGER_PATH, 
                               E_HAL_MANAGER_INTERFACE, 
                               "DeviceRemoved", _e_mod_kbd_device_dbus_del, NULL);
   _dev_chg = 
     e_dbus_signal_handler_add(_dbus_conn, E_HAL_SENDER, 
                               E_HAL_MANAGER_PATH, 
                               E_HAL_MANAGER_INTERFACE, 
                               "NewCapability", _e_mod_kbd_device_dbus_chg, NULL);
#endif
}