diff --git a/img/gen.sh b/img/gen.sh index e8ed417..0703e35 100755 --- a/img/gen.sh +++ b/img/gen.sh @@ -30,7 +30,13 @@ gpt_large.qcow2 () { local img=$FUNCNAME qemu-img create -f qcow2 -o $QCOW2_OPTS,cluster_size=2097152 $img 2E > /dev/null sudo qemu-nbd -c $NBD_DEV $img - + sleep 1 + # This is weird but the sleep above prevents the following error of the + # sgdisk below. A better understanding and fix is needed. + # Problem reading disk in BasicMBRData::ReadMBRData()! + # Warning! Read error 22; strange behavior now likely! + # Caution! Secondary header was placed beyond the disk's limits! Moving the + # header, but other problems may occur! $SGDISK --clear --new=0:0:+1023MiB --new=0:0:+1023GiB --new=0:0:+1023TiB \ --new=0:0:+1023PiB $NBD_DEV > /dev/null @@ -427,6 +433,7 @@ xfs_v4_xattr.qcow2 () { } xfs_v4_btrees_l2.qcow2 () { + echo "[*] This can take about ten minutes" local img=$FUNCNAME local img_raw=$(basename $img .qcow2).raw @@ -719,7 +726,7 @@ fat32_test0.raw () { sudo mount -o codepage=866,iocharset=utf8,umask=111,dmask=000 $p1 $TEMP_DIR $RANDDIR $TEMP_DIR 1000 8 255 65536 - $DIRTOTEST $TEMP_DIR $img hd0 > "../test/045/run.us" + $DIRTOTEST $TEMP_DIR $img hd0 > "../test/t045/run.us" # tree $TEMP_DIR # du -sh $TEMP_DIR @@ -841,6 +848,7 @@ exfat_s05k_c8k_b8k.qcow2 () { } xfs_samehash_s05k.raw () { + echo "[*] This can take about one hour" local img=$FUNCNAME # local img_raw=$(basename $img .qcow2).raw local img_raw=$img @@ -888,7 +896,7 @@ ext2_s05k.qcow2 () { local p1="$LOOP_DEV"p1 $MKFS_EXT2 $EXT_MKFS_OPTS -N 1200000 $p1 - debugfs -w -R "set_super_value hash_seed $EXT_HASH_SEED" $p1 > /dev/null + debugfs -w -R "set_super_value hash_seed $EXT_HASH_SEED" $p1 sudo mount $p1 $TEMP_DIR sudo chown $USER $TEMP_DIR -R # @@ -918,6 +926,7 @@ ext2_s05k.qcow2 () { } ext4_s05k.qcow2 () { + echo "[*] This can take about ten minutes" local img=$FUNCNAME local img_raw=$(basename $img .qcow2).raw @@ -927,7 +936,7 @@ ext4_s05k.qcow2 () { local p1="$LOOP_DEV"p1 $MKFS_EXT4 $EXT_MKFS_OPTS -N 1200000 $p1 - debugfs -w -R "set_super_value hash_seed $EXT_HASH_SEED" $p1 > /dev/null + debugfs -w -R "set_super_value hash_seed $EXT_HASH_SEED" $p1 sudo mount $p1 $TEMP_DIR sudo chown $USER $TEMP_DIR -R # @@ -1031,6 +1040,7 @@ fat16_s05k.qcow2 () { } iso9660_s2k_dir_all.qcow2 () { + echo "[*] This can take about thirty minutes" local img=$FUNCNAME local img_raw=$(basename $img .qcow2).raw @@ -1070,7 +1080,7 @@ iso9660_s2k_dir_all.qcow2 () { mkdir $TEMP_DIR/dir_stat_e $MKDOUBLEDIRS $TEMP_DIR/dir_stat_e d 3861 - mkisofs -J -R -v -T -V 'KolibriOS' $TEMP_DIR > $img_raw + mkisofs -J -R -T -V 'KolibriOS' -input-charset 'UTF-8' -quiet $TEMP_DIR > $img_raw rm $TEMP_DIR/* -rf qemu-img convert -m 2 -O qcow2 -o $QCOW2_OPTS $img_raw $img rm $img_raw diff --git a/shell.c b/shell.c index 73ae448..d0b116f 100644 --- a/shell.c +++ b/shell.c @@ -420,11 +420,16 @@ cmd_send_scancode(struct shell_ctx *ctx, int argc, char **argv) { argc -= 1; argv += 1; + struct umka_cmd *cmd = shell_get_cmd(ctx); + cmd->type = UMKA_CMD_SEND_SCANCODE; + struct cmd_send_scancode_arg *c = &cmd->send_scancode.arg; while (argc) { char *endptr; size_t code = strtoul(argv[0], &endptr, 0); if (*endptr == '\0') { - umka_set_keyboard_data(code); + c->scancode = code; + shell_run_cmd(ctx); + shell_clear_cmd(cmd); argc--; argv++; } else { @@ -4243,6 +4248,13 @@ shell_run_cmd_sync(struct shell_ctx *ctx) { COVERAGE_OFF(); break; } + case UMKA_CMD_SEND_SCANCODE: { + struct cmd_send_scancode_arg *c = &cmd->send_scancode.arg; + COVERAGE_ON(); + umka_set_keyboard_data(c->scancode); + COVERAGE_OFF(); + break; + } case UMKA_CMD_SYS_LFN: { struct cmd_sys_lfn_arg *c = &cmd->sys_lfn.arg; COVERAGE_ON(); diff --git a/shell.h b/shell.h index e312717..67d843a 100644 --- a/shell.h +++ b/shell.h @@ -69,6 +69,7 @@ enum { UMKA_CMD_SYS_PROCESS_INFO, UMKA_CMD_SYS_GET_MOUSE_POS_SCREEN, UMKA_CMD_SYS_LFN, + UMKA_CMD_SEND_SCANCODE, }; struct cmd_set_mouse_data_arg { @@ -156,12 +157,26 @@ struct cmd_wait_for_window { struct cmd_wait_for_window_ret ret; }; +struct cmd_send_scancode_arg { + int scancode; +}; + +struct cmd_send_scancode_ret { + char stub; +}; + +struct cmd_send_scancode { + struct cmd_send_scancode_arg arg; + struct cmd_send_scancode_ret ret; +}; + struct umka_cmd { atomic_int status; uint32_t type; union { // internal funcs struct cmd_set_mouse_data set_mouse_data; + struct cmd_send_scancode send_scancode; struct cmd_wait_for_window wait_for_window; // syscalls struct cmd_sys_csleep sys_csleep; diff --git a/umka_os.c b/umka_os.c index f38a315..656d6de 100644 --- a/umka_os.c +++ b/umka_os.c @@ -212,9 +212,6 @@ umka_display(void *arg) { SDL_Event event; while (1) { - struct umka_cmd *cmd; - struct cmd_set_mouse_data_arg *c; - uint32_t btn_state; update_display(window_surface, window); if (SDL_WaitEventTimeout(&event, 1000 /* ms */)) { switch (event.type) { @@ -223,13 +220,13 @@ umka_display(void *arg) { case SDL_WINDOWEVENT: break; case SDL_MOUSEBUTTONDOWN: - case SDL_MOUSEBUTTONUP: + case SDL_MOUSEBUTTONUP: { if (!input_grabbed) { break; } - cmd = shell_get_cmd(os->shell); + struct umka_cmd *cmd = shell_get_cmd(os->shell); cmd->type = UMKA_CMD_SET_MOUSE_DATA; - c = &cmd->set_mouse_data.arg; + struct cmd_set_mouse_data_arg *c = &cmd->set_mouse_data.arg; c->btn_state = event.button.state; c->xmoving = 0; c->ymoving = 0; @@ -238,13 +235,14 @@ umka_display(void *arg) { shell_run_cmd(os->shell); shell_clear_cmd(cmd); break; - case SDL_MOUSEMOTION: + } + case SDL_MOUSEMOTION: { if (!input_grabbed) { break; } - cmd = shell_get_cmd(os->shell); + struct umka_cmd *cmd = shell_get_cmd(os->shell); cmd->type = UMKA_CMD_SET_MOUSE_DATA; - c = &cmd->set_mouse_data.arg; + struct cmd_set_mouse_data_arg *c = &cmd->set_mouse_data.arg; c->btn_state = 0; c->xmoving = event.motion.xrel; c->ymoving = -event.motion.yrel; @@ -253,14 +251,15 @@ umka_display(void *arg) { shell_run_cmd(os->shell); shell_clear_cmd(cmd); break; - case SDL_MOUSEWHEEL: + } + case SDL_MOUSEWHEEL: { if (!input_grabbed) { break; } - btn_state = SDL_GetMouseState(NULL, NULL); - cmd = shell_get_cmd(os->shell); + uint32_t btn_state = SDL_GetMouseState(NULL, NULL); + struct umka_cmd *cmd = shell_get_cmd(os->shell); cmd->type = UMKA_CMD_SET_MOUSE_DATA; - c = &cmd->set_mouse_data.arg; + struct cmd_set_mouse_data_arg *c = &cmd->set_mouse_data.arg; c->btn_state = 0; if ((btn_state & SDL_BUTTON_LMASK)) { c->btn_state |= 0x01; @@ -280,7 +279,8 @@ umka_display(void *arg) { shell_run_cmd(os->shell); shell_clear_cmd(cmd); break; - case SDL_KEYDOWN: + } + case SDL_KEYDOWN: { if ((event.key.keysym.scancode == SDL_SCANCODE_G) && (event.key.keysym.mod & KMOD_CTRL) && (event.key.keysym.mod & KMOD_ALT)) { @@ -292,7 +292,13 @@ umka_display(void *arg) { if (!input_grabbed) { break; } + struct umka_cmd *cmd = shell_get_cmd(os->shell); + cmd->type = UMKA_CMD_SEND_SCANCODE; + struct cmd_send_scancode_arg *c = &cmd->send_scancode.arg; + shell_run_cmd(os->shell); + shell_clear_cmd(cmd); break; + } case SDL_KEYUP: if (!input_grabbed) { break;