/** * @brief tries to open the MSI gaming notebook's SteelSeries keyboard and if it succeeds, it will be closed * @returns true, if the keyboard could be opened, false otherwise */ bool keyboard_found() { hid_device* keyboard = open_keyboard(); if (keyboard != NULL) { hid_close(keyboard); return true; } else { return false; } }
int main(int argc, char** argv) { init_eink(); init_ptm(); open_keyboard(); //put_str("HELLO"); //draw_bitmap(); put_str("HELLO\n"); update_part(); init_reactor(10); add_callback(get_ptm(), update_disp, READ); add_callback(get_keyboard(), read_keyboard, READ); //add_callback(get_disp(), disp_allow, WRITE); //if(entries==2) { put_str("2\n"); } loop(); return 0; }
static void doit (DDEV_REQ *packet) { switch (packet->header.msgtyp) { case DEV_OPN: /* デバイスのオープン */ if (!initialized) { init_keyboard (); } open_keyboard (packet->header.mbfid, &(packet->body.opn_req)); break; case DEV_CLS: /* デバイスのクローズ */ close_keyboard (packet->header.mbfid, &(packet->body.cls_req)); break; case DEV_REA: read_keyboard (packet->header.mbfid, &(packet->body.rea_req)); break; case DEV_PRD: posix_read_keyboard (packet->header.mbfid, packet->header.tskid, &(packet->body.prd_req)); break; case DEV_RLY: relay_keyboard (packet->header.mbfid, &(packet->body.rly_req)); break; case DEV_WRI: write_keyboard (packet->header.mbfid, &(packet->body.wri_req)); break; case DEV_CTL: control_keyboard (packet->header.mbfid, &(packet->body.ctl_req)); break; } }
int main(int argc, const char * argv[]) { int fd = open_keyboard(); printf("%d\n", fd); return 0; }