Changes in uspace/app/vuhid/hids/bootkbd.c [bc255aa:faa44e58] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/vuhid/hids/bootkbd.c
rbc255aa rfaa44e58 93 93 0, 0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 94 94 }; 95 static vuhid_interface_life_t boot_life = { 96 .data_in = in_data, 97 .data_in_count = sizeof(in_data)/INPUT_SIZE, 98 .data_in_pos_change_delay = 500, 99 .msg_born = "Boot keyboard comes to life...", 100 .msg_die = "Boot keyboard died." 101 }; 95 static size_t in_data_count = sizeof(in_data)/INPUT_SIZE; 96 // FIXME - locking 97 static size_t in_data_position = 0; 98 99 static int on_data_in(vuhid_interface_t *iface, 100 void *buffer, size_t buffer_size, size_t *act_buffer_size) 101 { 102 static size_t last_pos = (size_t) -1; 103 size_t pos = in_data_position; 104 if (pos >= in_data_count) { 105 return EBADCHECKSUM; 106 } 107 108 if (last_pos == pos) { 109 return ENAK; 110 } 111 112 if (buffer_size > INPUT_SIZE) { 113 buffer_size = INPUT_SIZE; 114 } 115 116 if (act_buffer_size != NULL) { 117 *act_buffer_size = buffer_size; 118 } 119 120 memcpy(buffer, in_data + pos * INPUT_SIZE, buffer_size); 121 last_pos = pos; 122 123 return EOK; 124 } 102 125 103 126 static int on_data_out(vuhid_interface_t *iface, … … 118 141 } 119 142 143 144 static void live(vuhid_interface_t *iface) 145 { 146 async_usleep(1000 * 1000 * 5); 147 usb_log_debug("Boot keyboard comes to life...\n"); 148 while (in_data_position < in_data_count) { 149 async_usleep(1000 * 500); 150 in_data_position++; 151 } 152 usb_log_debug("Boot keyboard died.\n"); 153 } 154 155 120 156 vuhid_interface_t vuhid_interface_bootkbd = { 121 157 .id = "boot", … … 128 164 129 165 .in_data_size = INPUT_SIZE, 130 .on_data_in = interface_live_on_data_in,166 .on_data_in = on_data_in, 131 167 132 168 .out_data_size = 1, 133 169 .on_data_out = on_data_out, 134 170 135 .live = interface_life_live,171 .live = live, 136 172 137 .interface_data = &boot_life,138 173 .vuhid_data = NULL 139 174 };
Note:
See TracChangeset
for help on using the changeset viewer.