Changeset bc255aa in mainline
- Timestamp:
- 2011-09-20T19:24:15Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7d364fb8
- Parents:
- a347a11
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/vuhid/hids/bootkbd.c
ra347a11 rbc255aa 93 93 0, 0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 94 94 }; 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 } 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 }; 125 102 126 103 static int on_data_out(vuhid_interface_t *iface, … … 141 118 } 142 119 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 156 120 vuhid_interface_t vuhid_interface_bootkbd = { 157 121 .id = "boot", … … 164 128 165 129 .in_data_size = INPUT_SIZE, 166 .on_data_in = on_data_in,130 .on_data_in = interface_live_on_data_in, 167 131 168 132 .out_data_size = 1, 169 133 .on_data_out = on_data_out, 170 134 171 .live = live,135 .live = interface_life_live, 172 136 137 .interface_data = &boot_life, 173 138 .vuhid_data = NULL 174 139 };
Note:
See TracChangeset
for help on using the changeset viewer.