static DFBResult driver_open_device(CoreInputDevice *device, unsigned int number, InputDeviceInfo *info, void **driver_data) { int fd; eloData *data; /* open device */ fd = eloOpenDevice(elo_DEVICE); if(fd < 0) { D_PERROR("DirectFB/elo: Error opening '"elo_DEVICE"'!\n"); return DFB_INIT; } data = D_CALLOC(1, sizeof(eloData)); if (!data) { close(fd); return D_OOM(); } data->fd = fd; data->device = device; /* Must define the correct resolution of screen */ data->screen_width = elo_SCREENWIDTH; data->screen_height = elo_SCREENHEIGHT; /* The following variable are defined to adjust the orientation of * the touchscreen. Variables are either max screen height/width or 0. */ data->min_x = elo_MINX; data->min_y = elo_MINY; /* fill device info structure */ snprintf(info->desc.name, DFB_INPUT_DEVICE_DESC_NAME_LENGTH, "elo"); snprintf(info->desc.vendor, DFB_INPUT_DEVICE_DESC_VENDOR_LENGTH, "elo Systems"); info->prefered_id = DIDID_MOUSE; info->desc.type = DIDTF_MOUSE; info->desc.caps = DICAPS_AXES | DICAPS_BUTTONS; info->desc.max_axis = DIAI_Y; info->desc.max_button = DIBI_LEFT; /* start input thread */ data->thread = direct_thread_create (DTT_INPUT, eloTouchEventThread, data, "ELO Touch Input"); /* set private data pointer */ *driver_data = data; return DFB_OK; }
static int driver_get_available( void ) { int fd; fd = eloOpenDevice (elo_DEVICE); if (fd < 0) return 0; close(fd); return 1; }
static int driver_get_available( void ) { int fd; /* we will only use the ELO device if it has been configured */ if(!dfb_config->elo_device) { return 0; } fd = eloOpenDevice (dfb_config->elo_device); if (fd < 0) { D_INFO("Elo:driver_get_available NON OK\n"); return 0; } close(fd); return 1; }