diff options
| author | cpplover0 <osdev555@yandex.com> | 2025-11-22 07:31:03 +0300 |
|---|---|---|
| committer | cpplover0 <osdev555@yandex.com> | 2025-11-22 07:31:03 +0300 |
| commit | 091aec7d536480dd9517a592767658bbfb80945e (patch) | |
| tree | 9f38d032d1360f0bee3d3a02aa375f4526f1a10d | |
| parent | 56f969c8ccd65fd116144f11463a8e0c26589fd5 (diff) | |
new work.png
| -rw-r--r-- | GNUmakefile | 2 | ||||
| -rw-r--r-- | tools/img/oldwork2.png | bin | 0 -> 52721 bytes | |||
| -rw-r--r-- | tools/img/work.png | bin | 52721 -> 485722 bytes | |||
| -rw-r--r-- | tools/initbase/root/.config/i3/config | 2 | ||||
| -rw-r--r-- | tools/pkg/2/xhci_driver/src/main.cpp | 57 |
5 files changed, 33 insertions, 28 deletions
diff --git a/GNUmakefile b/GNUmakefile index 4617156..1af07c9 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,7 +3,7 @@ MAKEFLAGS += -rR .SUFFIXES: # Default user QEMU flags. These are appended to the QEMU command calls. -QEMUFLAGS := -m 8G -d int -no-reboot -s -M q35 -smp 1 -enable-kvm -serial stdio +QEMUFLAGS := -m 8G -d int -no-reboot -s -M q35 -smp 1 -enable-kvm -serial stdio -device qemu-xhci -device usb-kbd -device usb-mouse override IMAGE_NAME := orange diff --git a/tools/img/oldwork2.png b/tools/img/oldwork2.png Binary files differnew file mode 100644 index 0000000..6b324e8 --- /dev/null +++ b/tools/img/oldwork2.png diff --git a/tools/img/work.png b/tools/img/work.png Binary files differindex 6b324e8..697c638 100644 --- a/tools/img/work.png +++ b/tools/img/work.png diff --git a/tools/initbase/root/.config/i3/config b/tools/initbase/root/.config/i3/config index 68b9fcf..d64cfaa 100644 --- a/tools/initbase/root/.config/i3/config +++ b/tools/initbase/root/.config/i3/config @@ -9,7 +9,7 @@ # # Please see https://i3wm.org/docs/userguide.html for a complete reference! -set $mod Control +set $mod mod1 # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. diff --git a/tools/pkg/2/xhci_driver/src/main.cpp b/tools/pkg/2/xhci_driver/src/main.cpp index 9be4dd9..ba54317 100644 --- a/tools/pkg/2/xhci_driver/src/main.cpp +++ b/tools/pkg/2/xhci_driver/src/main.cpp @@ -1361,25 +1361,30 @@ void input_send(uint8_t key) { write(input0_fd,&key,1); } -void __usbkeyboard_handler(xhci_usb_device_t* usbdev, xhci_done_trb_t* trb) { +uint8_t hid_mods_to_ps2[8] = { + 0x1D, + 0x2A, + 0x38, + 0x5B, + 0x1D, + 0x36, + 0x38, + 0x5C +}; +void __usbkeyboard_handler(xhci_usb_device_t* usbdev, xhci_done_trb_t* trb) { uint8_t* data = usbdev->buffers[trb->info_s.ep_id - 2]; - uint8_t add = data[0]; - - if ((add == 2 || add == 32) && usbdev->add_buffer[0] != add) { - input_send(0x2A); - } else if ((add == 1) && usbdev->add_buffer[0] != add) { - input_send(29); - } - - if (usbdev->add_buffer[0] == 2 || usbdev->add_buffer[0] == 32) { - if (add != 2 && add != 32) { - input_send(0x2A | (1 << 7)); - } - } else if(usbdev->add_buffer[0] == 1) { - if(add != 1) { - input_send(29 | (1 << 7)); - input_send(0x2A | (1 << 7)); + uint8_t mods = data[0]; + uint8_t prev_mods = usbdev->add_buffer[0]; + + for (int i = 0; i < 8; i++) { + uint8_t mask = 1 << i; + if ((mods & mask) && !(prev_mods & mask)) { + if (i >= 4) input_send(0xE0); + input_send(hid_mods_to_ps2[i]); + } else if (!(mods & mask) && (prev_mods & mask)) { + if (i >= 4) input_send(0xE0); + input_send(hid_mods_to_ps2[i] | 0x80); } } @@ -1388,33 +1393,33 @@ void __usbkeyboard_handler(xhci_usb_device_t* usbdev, xhci_done_trb_t* trb) { for (int j = 2; j < 8; j++) { if (usbdev->add_buffer[j] == data[i]) { isPressed = 1; - break; + break; } } - if (!isPressed && data[i] != 0) { - if(data[i] < 0x47) { + if (!isPressed && data[i] != 0) { + if (data[i] < 0x47) { input_send(hid_to_ps2_layout[data[i]]); } } } for (int i = 2; i < 8; i++) { - int isStillPressed = 0; + int isStillPressed = 0; for (int j = 2; j < 8; j++) { if (usbdev->add_buffer[i] == data[j]) { - isStillPressed = 1; - break; + isStillPressed = 1; + break; } } - if (!isStillPressed && usbdev->add_buffer[i] != 0) { - input_send(hid_to_ps2_layout[usbdev->add_buffer[i]] | (1 << 7)); + if (!isStillPressed && usbdev->add_buffer[i] != 0) { + input_send(hid_to_ps2_layout[usbdev->add_buffer[i]] | 0x80); } } - memcpy(usbdev->add_buffer, data, 8); } + #define MOUSE_LB (1 << 0) #define MOUSE_RB (1 << 1) #define MOUSE_MB (1 << 2) |
