void playback_sensor::open(const stream_profiles& requests) { //Playback can only play the streams that were recorded. //Go over the requested profiles and see if they are available LOG_DEBUG("Open Sensor " << m_sensor_id); for (auto&& r : requests) { if (std::find_if(std::begin(m_available_profiles), std::end(m_available_profiles), [r](const std::shared_ptr<stream_profile_interface>& s) { return r->get_unique_id() == s->get_unique_id(); }) == std::end(m_available_profiles)) { throw std::runtime_error(to_string() << "Failed to open sensor, requested profile: " << profile_to_string(r) << " is not available"); } } std::vector<device_serializer::stream_identifier> opened_streams; //For each stream, create a dedicated dispatching thread for (auto&& profile : requests) { m_dispatchers.emplace(std::make_pair(profile->get_unique_id(), std::make_shared<dispatcher>(10))); //TODO: what size the queue should be? m_dispatchers[profile->get_unique_id()]->start(); device_serializer::stream_identifier f{ get_device_index(), m_sensor_id, profile->get_stream_type(), static_cast<uint32_t>(profile->get_stream_index()) }; opened_streams.push_back(f); } m_active_streams = requests; opened(opened_streams); }
static NTSTATUS printer_close(NTHANDLE handle) { int i = get_device_index(handle); if (i >= 0) { PRINTER *pprinter_data = g_rdpdr_device[i].pdevice_data; if (pprinter_data) pclose(pprinter_data->printer_fp); g_rdpdr_device[i].handle = 0; } return STATUS_SUCCESS; }
void playback_sensor::close() { LOG_DEBUG("Close sensor " << m_sensor_id); std::vector<device_serializer::stream_identifier> closed_streams; for (auto dispatcher : m_dispatchers) { dispatcher.second->flush(); for (auto available_profile : m_available_profiles) { if (available_profile->get_unique_id() == dispatcher.first) { closed_streams.push_back({ get_device_index(), m_sensor_id, available_profile->get_stream_type(), static_cast<uint32_t>(available_profile->get_stream_index()) }); } } } m_dispatchers.clear(); m_active_streams.clear(); closed(closed_streams); }
int main(int argc, char** argv) { Device* device; retcode = 0; get_options(argc, argv); if (cmd_args.help) usage(); device = (Device*) malloc(sizeof(Device)); get_device_id(device); if (device->id == NULL) { retcode = 2; goto cleanup; } printf("Found USB Device: %s\n", device->id); get_device_index(device); if (device->index < 0) { retcode = 3; goto cleanup; } get_file_path(device); program_device(device); cleanup: free(device->id); free(device->file); free(device); return retcode; }
static int coda_fill_super(struct super_block *sb, void *data, int silent) { struct inode *root = NULL; struct venus_comm *vc; struct CodaFid fid; int error; int idx; idx = get_device_index((struct coda_mount_data *) data); /* Ignore errors in data, for backward compatibility */ if(idx == -1) idx = 0; printk(KERN_INFO "coda_read_super: device index: %i\n", idx); vc = &coda_comms[idx]; mutex_lock(&vc->vc_mutex); if (!vc->vc_inuse) { printk("coda_read_super: No pseudo device\n"); error = -EINVAL; goto unlock_out; } if (vc->vc_sb) { printk("coda_read_super: Device already mounted\n"); error = -EBUSY; goto unlock_out; } error = bdi_setup_and_register(&vc->bdi, "coda", BDI_CAP_MAP_COPY); if (error) goto unlock_out; vc->vc_sb = sb; mutex_unlock(&vc->vc_mutex); sb->s_fs_info = vc; sb->s_flags |= MS_NOATIME; sb->s_blocksize = 4096; /* XXXXX what do we put here?? */ sb->s_blocksize_bits = 12; sb->s_magic = CODA_SUPER_MAGIC; sb->s_op = &coda_super_operations; sb->s_d_op = &coda_dentry_operations; sb->s_bdi = &vc->bdi; /* get root fid from Venus: this needs the root inode */ error = venus_rootfid(sb, &fid); if ( error ) { printk("coda_read_super: coda_get_rootfid failed with %d\n", error); goto error; } printk("coda_read_super: rootfid is %s\n", coda_f2s(&fid)); /* make root inode */ error = coda_cnode_make(&root, &fid, sb); if ( error || !root ) { printk("Failure of coda_cnode_make for root: error %d\n", error); goto error; } printk("coda_read_super: rootinode is %ld dev %s\n", root->i_ino, root->i_sb->s_id); sb->s_root = d_make_root(root); if (!sb->s_root) { error = -EINVAL; goto error; } return 0; error: if (root) iput(root); mutex_lock(&vc->vc_mutex); bdi_destroy(&vc->bdi); vc->vc_sb = NULL; sb->s_fs_info = NULL; unlock_out: mutex_unlock(&vc->vc_mutex); return error; }
static int coda_fill_super(struct super_block *sb, void *data, int silent) { struct inode *root = NULL; struct venus_comm *vc; struct CodaFid fid; int error; int idx; if (task_active_pid_ns(current) != &init_pid_ns) return -EINVAL; idx = get_device_index((struct coda_mount_data *) data); /* Ignore errors in data, for backward compatibility */ if(idx == -1) idx = 0; pr_info("%s: device index: %i\n", __func__, idx); vc = &coda_comms[idx]; mutex_lock(&vc->vc_mutex); if (!vc->vc_inuse) { pr_warn("%s: No pseudo device\n", __func__); error = -EINVAL; goto unlock_out; } if (vc->vc_sb) { pr_warn("%s: Device already mounted\n", __func__); error = -EBUSY; goto unlock_out; } vc->vc_sb = sb; mutex_unlock(&vc->vc_mutex); sb->s_fs_info = vc; sb->s_flags |= MS_NOATIME; sb->s_blocksize = 4096; /* XXXXX what do we put here?? */ sb->s_blocksize_bits = 12; sb->s_magic = CODA_SUPER_MAGIC; sb->s_op = &coda_super_operations; sb->s_d_op = &coda_dentry_operations; error = super_setup_bdi(sb); if (error) goto error; /* get root fid from Venus: this needs the root inode */ error = venus_rootfid(sb, &fid); if ( error ) { pr_warn("%s: coda_get_rootfid failed with %d\n", __func__, error); goto error; } pr_info("%s: rootfid is %s\n", __func__, coda_f2s(&fid)); /* make root inode */ root = coda_cnode_make(&fid, sb); if (IS_ERR(root)) { error = PTR_ERR(root); pr_warn("Failure of coda_cnode_make for root: error %d\n", error); goto error; } pr_info("%s: rootinode is %ld dev %s\n", __func__, root->i_ino, root->i_sb->s_id); sb->s_root = d_make_root(root); if (!sb->s_root) { error = -EINVAL; goto error; } return 0; error: mutex_lock(&vc->vc_mutex); vc->vc_sb = NULL; sb->s_fs_info = NULL; unlock_out: mutex_unlock(&vc->vc_mutex); return error; }
int CMX_Bundlelight::FrameMake(unsigned char cmd_flag, unsigned char order, unsigned char function1, unsigned char function2, unsigned char function3, unsigned char function4) { int result = 0; int gas_open = FALSE; D_Item gas1_item; D_Item gas2_item; enum DEVICE_PROTOCOL dProtocol; if(cmd_flag == POLLING_CMD) { //일괄소등 가스 밸브 상태 확인은 가스 밸브 1번 아이디만 확인 한다. buf[0] = BUNDLELIGHT_STATUS_COMMAND; buf[1] = order; if(get_device_index(GAS) != -1) { get_device_item(GAS, 1, &gas1_item); if(gas1_item.gasItem.action == GAS_OPEN) gas_open = TRUE; if(get_current_supported_cnt(GAS) > 1) { get_device_item(GAS, 2, &gas2_item); if(gas2_item.gasItem.action == GAS_OPEN) gas_open = TRUE; } if(gas_open == TRUE) buf[2] = 0x01; else buf[2] = 0x00; } else buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; result = FrameSend(buf); } if(cmd_flag == CONTROL_CMD) { //이전 현장에 설치된 제품과 제어 command 구분 필요 (function 기능이 없으면 이전 현장) if(bundlelightStatus[order - 1].supported_function._none == SUPPORTED) { buf[0] = OLD_BUNDLELIGHT_CTRL_COMMAND; buf[1] = order; switch(function1) { case BUNDLELIGHT_POWER_EVENT: { if(function2 == BUNDLELIGHT_POWER_ON) buf[2] = 0x01; else if(function2 == BUNDLELIGHT_POWER_OFF) buf[2] = 0x00; } break; default: break; } buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; } else { switch(function1) { case BUNDLELIGHT_POWER_EVENT: { if(function2 == BUNDLELIGHT_POWER_ON) { buf[0] = NEW_BUNDLELIGHT_CTRL_COMMAND; buf[1] = order; buf[2] = 0x01; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; } else if(function2 == BUNDLELIGHT_POWER_OFF) { buf[0] = NEW_BUNDLELIGHT_CTRL_COMMAND; buf[1] = order; if(bundlelightStatus[order - 1].readyPower == BUNDLELIGHT_READYPOWER_ON) buf[2] = 0x02; else buf[2] = 0x00; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; } else if(function2 == BUNDLELIGHT_POWER_ALLON) { buf[0] = BUNDLELIGHT_GROUP_POWER_COMMAND; buf[1] = 0xFF; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; } else if(function2 == BUNDLELIGHT_POWER_ALLOFF) { buf[0] = BUNDLELIGHT_GROUP_POWER_COMMAND; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; } } break; case BUNDLELIGHT_READYPOWER_EVENT: { if(function2 == BUNDLELIGHT_READYPOWER_ON) { buf[0] = NEW_BUNDLELIGHT_CTRL_COMMAND; buf[1] = order; buf[2] = 0x02; buf[3] = 0x02; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; } else if(function2 == BUNDLELIGHT_READYPOWER_OFF) { buf[0] = NEW_BUNDLELIGHT_CTRL_COMMAND; buf[1] = order; if(bundlelightStatus[order - 1].power == BUNDLELIGHT_POWER_ON) buf[2] = 0x01; else buf[2] = 0x00; buf[3] = 0x02; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; } else if(function2 == BUNDLELIGHT_READYPOWER_ALLON) { buf[0] = BUNDLELIGHT_GROUP_READYPOWER_COMMAND; buf[1] = 0xFF; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; } else if(function2 == BUNDLELIGHT_READYPOWER_ALLOFF) { buf[0] = BUNDLELIGHT_GROUP_READYPOWER_COMMAND; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; } } break; case BUNDLELIGHT_OUT_EVENT: { if(function2 == BUNDLELIGHT_OUT_REQUEST_SUCCESS) { buf[0] = NEW_BUNDLELIGHT_CTRL_COMMAND; buf[1] = order; buf[2] = 0x04; buf[3] = 0x03; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; bundlelightStatus[order -1].out = BUNDLELIGHT_OUT_NONE; } else if(function2 == BUNDLELIGHT_OUT_REQUEST_FAIL) { buf[0] = NEW_BUNDLELIGHT_CTRL_COMMAND; buf[1] = order; buf[2] = 0x08; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; bundlelightStatus[order -1].out = BUNDLELIGHT_OUT_REQUEST_FAIL; } else if(function2 == BUNDLELIGHT_OUT_SET) { buf[0] = BUNDLELIGHT_OUTMODE_COMMAND; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; bundlelightStatus[order -1].out = BUNDLELIGHT_OUT_SET; } else if(function2 == BUNDLELIGHT_OUT_CANCEL) { buf[0] = BUNDLELIGHT_OUTMODE_COMMAND; buf[1] = 0x01; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; bundlelightStatus[order -1].out = BUNDLELIGHT_OUT_CANCEL; } } break; case BUNDLELIGHT_GASCLOSE_EVENT: { if(function2 == BUNDLELIGHT_GASCLOSE_REQUEST_SUCCESS) { buf[0] = NEW_BUNDLELIGHT_CTRL_COMMAND; buf[1] = order; buf[2] = 0x10; buf[3] = 0x05; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; bundlelightStatus[order -1].gasClose = BUNDLELIGHT_GASCLOSE_NONE; } else if(function2 == BUNDLELIGHT_GASCLOSE_REQUEST_FAIL) { buf[0] = NEW_BUNDLELIGHT_CTRL_COMMAND; buf[1] = order; buf[2] = 0x20; buf[3] = 0x06; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; bundlelightStatus[order -1].gasClose = BUNDLELIGHT_GASCLOSE_REQUEST_FAIL; } } break; case BUNDLELIGHT_ELEVATORCALL_EVENT: { if(function2 == BUNDLELIGHT_ELEVATORCALL_REQUEST_SUCCESS) { buf[0] = NEW_BUNDLELIGHT_CTRL_COMMAND; buf[1] = order; buf[2] = 0x40; buf[3] = 0x07; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; bundlelightStatus[order -1].elevatorCall = BUNDLELIGHT_ELEVATORCALL_NONE; } else if(function2 == BUNDLELIGHT_ELEVATORCALL_REQUEST_FAIL) { buf[0] = NEW_BUNDLELIGHT_CTRL_COMMAND; buf[1] = order; buf[2] = 0x80; buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = buf[0] + buf[1] + buf[2] + buf[3] + buf[4] + buf[5] + buf[6]; bundlelightStatus[order -1].elevatorCall = BUNDLELIGHT_ELEVATORCALL_REQUEST_FAIL; } } break; default: break; } } result = FrameSend(buf); } return result; }
static struct super_block * coda_read_super(struct super_block *sb, void *data, int silent) { struct inode *root = 0; struct coda_sb_info *sbi = NULL; struct venus_comm *vc = NULL; ViceFid fid; int error; int idx; idx = get_device_index((struct coda_mount_data *) data); /* Ignore errors in data, for backward compatibility */ if(idx == -1) idx = 0; printk(KERN_INFO "coda_read_super: device index: %i\n", idx); vc = &coda_comms[idx]; if (!vc->vc_inuse) { printk("coda_read_super: No pseudo device\n"); return NULL; } if ( vc->vc_sb ) { printk("coda_read_super: Device already mounted\n"); return NULL; } sbi = kmalloc(sizeof(struct coda_sb_info), GFP_KERNEL); if(!sbi) { return NULL; } vc->vc_sb = sb; sbi->sbi_sb = sb; sbi->sbi_vcomm = vc; INIT_LIST_HEAD(&sbi->sbi_cihead); sb->u.generic_sbp = sbi; sb->s_blocksize = 1024; /* XXXXX what do we put here?? */ sb->s_blocksize_bits = 10; sb->s_magic = CODA_SUPER_MAGIC; sb->s_op = &coda_super_operations; /* get root fid from Venus: this needs the root inode */ error = venus_rootfid(sb, &fid); if ( error ) { printk("coda_read_super: coda_get_rootfid failed with %d\n", error); goto error; } printk("coda_read_super: rootfid is %s\n", coda_f2s(&fid)); /* make root inode */ error = coda_cnode_make(&root, &fid, sb); if ( error || !root ) { printk("Failure of coda_cnode_make for root: error %d\n", error); goto error; } printk("coda_read_super: rootinode is %ld dev %d\n", root->i_ino, root->i_dev); sb->s_root = d_alloc_root(root); return sb; error: if (sbi) { kfree(sbi); if(vc) vc->vc_sb = NULL; } if (root) iput(root); return NULL; }
/** * Defined case run in PCBA mode, fully automatically. * */ static int32_t module_run_pcba(const mmi_module_t * module, hash_map < string, string > ¶ms) { ALOGI("[%s] start", __FUNCTION__); DIR *dir; struct dirent *de; int fd; int i = 0, j = 0; bool ret = FAILED; int max_event_index = 0; int index = 0; char buffer[NAME_MAX]; char format_buf[NAME_MAX]; char filepath[PATH_MAX] = { 0 }; unsigned long keyBitmask[BITS_TO_LONGS(KEY_MAX)]; unsigned long absBitmask[BITS_TO_LONGS(ABS_MAX)]; struct input_id id; if(module == NULL) { ALOGE("%s NULL point received ", __FUNCTION__); return FAILED; } dir = opendir("/dev/input"); if(dir == 0) return -1; while((de = readdir(dir))) { if(strncmp(de->d_name, "event", 5)) continue; get_device_index(de->d_name, "event", &index); if(index > max_event_index) max_event_index = index; } for(i = 0; i < max_event_index + 1; i++) { unsigned long ev_bits[BITS_TO_LONGS(EV_MAX)]; snprintf(filepath, sizeof(filepath), "/dev/input/event%d", i); fd = open(filepath, O_RDONLY); if(fd < 0) continue; /* read the evbits of the input device */ if(ioctl(fd, EVIOCGBIT(0, sizeof(ev_bits)), ev_bits) < 0) { close(fd); continue; } /* TODO: add ability to specify event masks. For now, just assume * that only EV_KEY and EV_REL event types are ever needed. */ if(!test_bit(EV_KEY, ev_bits) && !test_bit(EV_REL, ev_bits)) { ALOGE("could not get EV_KEY for %d, %s\n", fd, strerror(errno)); close(fd); continue; } /* read the evbits of the input device */ if(ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keyBitmask)), keyBitmask) < 0) { ALOGE("could not get keyBitmask for fd:%d, %s\n", fd, strerror(errno)); close(fd); continue; } if(ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absBitmask)), absBitmask) < 0) { ALOGE("could not get absBitmask for fd:%d, %s\n", fd, strerror(errno)); close(fd); continue; } /*See if this is a touch pad. Is this a new modern multi-touch driver */ if(test_bit(ABS_MT_POSITION_X, absBitmask) && test_bit(ABS_MT_POSITION_Y, absBitmask)) { ret = SUCCESS; if(ioctl(fd, EVIOCGNAME(sizeof(format_buf) - 1), &format_buf) < 1) { ALOGE("could not get device name for fd:%d, %s\n", fd, strerror(errno)); close(fd); continue; } snprintf(buffer, sizeof(buffer), "name = %s\n", format_buf); if(ioctl(fd, EVIOCGID, &id)) { ALOGE("could not get device id for fd:%d, %s\n", fd, strerror(errno)); close(fd); continue; } snprintf(format_buf, sizeof(format_buf), "bus = %04x\n" "vendor = %04x\n" "product = %04x\n" "version = %04x\n", id.bustype, id.vendor, id.product, id.version); strlcat(buffer, format_buf, sizeof(buffer)); module->cb_print(params[KEY_MODULE_NAME].c_str(), SUBCMD_PCBA, buffer, strlen(buffer), PRINT_DATA); } } closedir(dir); return ret; }
static int exynos_open(struct hook_data *data) { char buf[32]; int devidx; int fd = -1; struct exynos_drm *drm = NULL; struct exynos_fliphandler *fliphandler = NULL; unsigned i; assert(data->drm_fd == -1); devidx = get_device_index(); if (devidx != -1) { snprintf(buf, sizeof(buf), "/dev/dri/card%d", devidx); } else { fprintf(stderr, "[exynos_open] error: no compatible DRM device found\n"); return -1; } fd = data->open(buf, O_RDWR, 0); if (fd == -1) { fprintf(stderr, "[exynos_open] error: failed to open DRM device\n"); return -1; } if (vconf.use_screen == 0) { fprintf(stderr, "[exynos_open] info: skipping screen initialization\n"); data->drm_fd = fd; return 0; } drm = calloc(1, sizeof(struct exynos_drm)); if (drm == NULL) { fprintf(stderr, "[exynos_open] error: failed to allocate DRM\n"); close(fd); return -1; } drm->resources = drmModeGetResources(fd); if (drm->resources == NULL) { fprintf(stderr, "[exynos_open] error: failed to get DRM resources\n"); goto fail; } for (i = 0; i < drm->resources->count_connectors; ++i) { if (vconf.monitor_index != 0 && vconf.monitor_index - 1 != i) continue; drm->connector = drmModeGetConnector(fd, drm->resources->connectors[i]); if (drm->connector == NULL) continue; if (drm->connector->connection == DRM_MODE_CONNECTED && drm->connector->count_modes > 0) break; drmModeFreeConnector(drm->connector); drm->connector = NULL; } if (i == drm->resources->count_connectors) { fprintf(stderr, "[exynos_open] error: no currently active connector found\n"); goto fail; } for (i = 0; i < drm->resources->count_encoders; i++) { drm->encoder = drmModeGetEncoder(fd, drm->resources->encoders[i]); if (drm->encoder == NULL) continue; if (drm->encoder->encoder_id == drm->connector->encoder_id) break; drmModeFreeEncoder(drm->encoder); drm->encoder = NULL; } fliphandler = calloc(1, sizeof(struct exynos_fliphandler)); if (fliphandler == NULL) { fprintf(stderr, "[exynos_open] error: failed to allocate fliphandler\n"); goto fail; } /* Setup the flip handler. */ fliphandler->fds.fd = fd; fliphandler->fds.events = POLLIN; fliphandler->evctx.version = DRM_EVENT_CONTEXT_VERSION; fliphandler->evctx.page_flip_handler = page_flip_handler; data->drm_fd = fd; data->drm = drm; data->fliphandler = fliphandler; fprintf(stderr, "[exynos_open] info: using DRM device \"%s\" with connector id %u\n", buf, data->drm->connector->connector_id); return 0; fail: free(fliphandler); clean_up_drm(drm, fd); return -1; }