fix kappl and read

This commit is contained in:
2026-01-09 21:43:07 +01:00
parent 864a1030e7
commit 262fb26ea9
2 changed files with 4 additions and 4 deletions

View File

@@ -66,16 +66,16 @@ size_t read(Vault &vault, uint32_t id, void *buf, size_t len) {
(void)id; (void)id;
size_t read_cnt = 0; size_t read_cnt = 0;
while(read_cnt <= len){ while(read_cnt < len){
Key key; Key key;
vault.keys_sem.p(vault); vault.keys_sem.p(vault);
vault.keys.consume(key); vault.keys.consume(key);
if(key.valid()) if(key.valid())
((char*)buf)[read_cnt++] = key.ascii(); ((char*)buf)[read_cnt++] = key.ascii();
else else
return read_cnt; break;
} }
return len; return read_cnt;
} }
void sleep(Vault &vault, size_t ms) { void sleep(Vault &vault, size_t ms) {

View File

@@ -15,7 +15,7 @@ void KeyboardApplication::action() { // NOLINT
while(1){ while(1){
char msg[11]; char msg[11];
int len; int len;
len = read(0, msg, 10); len = read(0, msg, 1);
if(len){ if(len){
write(0, msg, len); write(0, msg, len);
memcpy(&cmd_buff[bufferpos], msg, len); memcpy(&cmd_buff[bufferpos], msg, len);