static void *qnx_input_init(void) { int i; qnx_input_t *qnx = (qnx_input_t*)calloc(1, sizeof(*qnx)); if (!qnx) return NULL; for (i = 0; i < MAX_TOUCH; ++i) { qnx->pointer[i].contact_id = -1; qnx->touch_map[i] = -1; } qnx->joypad = input_joypad_init_driver(g_settings.input.joypad_driver); for (i = 0; i < MAX_PADS; ++i) { initController(qnx, &qnx->devices[i]); qnx->port_device[i] = 0; } #ifdef HAVE_BB10 /* Find currently connected gamepads. */ discoverControllers(qnx); #else /* Initialize Playbook keyboard. */ strlcpy(qnx->devices[0].id, "0A5C-8502", sizeof(qnx->devices[0].id)); qnx_input_autodetect_gamepad(qnx, &qnx->devices[0], 0); qnx->pads_connected = 1; #endif return qnx; }
static void *qnx_input_init(const char *joypad_driver) { int i; qnx_input_t *qnx = (qnx_input_t*)calloc(1, sizeof(*qnx)); if (!qnx) return NULL; input_keymaps_init_keyboard_lut(rarch_key_map_qnx); for (i = 0; i < MAX_TOUCH; ++i) { qnx->pointer[i].contact_id = -1; qnx->touch_map[i] = -1; } qnx->joypad = input_joypad_init_driver(joypad_driver, qnx); for (i = 0; i < MAX_PADS; ++i) { qnx_init_controller(qnx, &qnx->devices[i]); } #ifdef HAVE_BB10 qnx_discover_controllers(qnx); #else /* Initialize Playbook keyboard. */ strlcpy(qnx->devices[0].id, "0A5C-8502", sizeof(qnx->devices[0].id)); qnx_input_autodetect_gamepad(qnx, &qnx->devices[0]); qnx->pads_connected = 1; #endif return qnx; }
static void handle_device(void *data, input_device_t* controller) { int device; qnx_input_t *qnx = (qnx_input_t*)data; (void)device; if (!qnx) return; /* Query libscreen for information about this device. */ screen_get_device_property_iv(controller->handle, SCREEN_PROPERTY_TYPE, &controller->type); screen_get_device_property_cv(controller->handle, SCREEN_PROPERTY_ID_STRING, sizeof(controller->id), controller->id); screen_get_device_property_cv(controller->handle, SCREEN_PROPERTY_VENDOR, sizeof(controller->id), controller->vid); screen_get_device_property_cv(controller->handle, SCREEN_PROPERTY_PRODUCT, sizeof(controller->id), controller->pid); if (controller->type == SCREEN_EVENT_GAMEPAD || controller->type == SCREEN_EVENT_JOYSTICK) { screen_get_device_property_iv(controller->handle, SCREEN_PROPERTY_BUTTON_COUNT, &controller->buttonCount); /* Check for the existence of analog sticks. */ if (!screen_get_device_property_iv(controller->handle, SCREEN_PROPERTY_ANALOG0, controller->analog0)) ++controller->analogCount; if (!screen_get_device_property_iv(controller->handle, SCREEN_PROPERTY_ANALOG1, controller->analog1)) ++controller->analogCount; } /* Screen service will map supported controllers, * we still might need to adjust. */ qnx_input_autodetect_gamepad(qnx, controller, controller->port); if (controller->type == SCREEN_EVENT_GAMEPAD) RARCH_LOG("Gamepad Device Connected:\n"); else if (controller->type == SCREEN_EVENT_JOYSTICK) RARCH_LOG("Joystick Device Connected:\n"); else if (controller->type == SCREEN_EVENT_KEYBOARD) RARCH_LOG("Keyboard Device Connected:\n"); RARCH_LOG("\tID: %s\n", controller->id); RARCH_LOG("\tVendor ID: %s\n", controller->vid); RARCH_LOG("\tProduct ID: %s\n", controller->pid); RARCH_LOG("\tButton Count: %d\n", controller->buttonCount); RARCH_LOG("\tAnalog Count: %d\n", controller->analogCount); }
void init_playbook_keyboard() { strlcpy(devices[0].id, "0A5C-8502", sizeof(devices[0].id)); qnx_input_autodetect_gamepad(&devices[0]); pads_connected = 1; }