feat: Implement system power management with Ctrl+Alt+Del and Ctrl+Alt+Esc#32
feat: Implement system power management with Ctrl+Alt+Del and Ctrl+Alt+Esc#32ionutnechita wants to merge 2 commits intodifferrari:mainfrom ionutnechita:power-commands
Conversation
…t+Esc Description: - Added power management system with power_off() and reboot() functions - Implemented Ctrl+Alt+Del for system shutdown - Added Ctrl+Alt+Esc for system reboot - Added syscalls for power management (60: poweroff, 61: reboot) - Updated login screen with shutdown hint - Added necessary key code definitions Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
Signed-off-by: Ionut Nechita <ionut_n2001@yahoo.com>
| kprintf("[FAT32] File not found in open_files for id %x", descriptor->id); | ||
| return 0; | ||
| } | ||
| // Limit to actual file size |
There was a problem hiding this comment.
Thanks for the improvement, but please keep the original TODO comment. We're not guaranteed that descriptor->size is the correct size, since it can be modified externally
There was a problem hiding this comment.
The code itself is fine, it's just about remembering to properly implement this later on
There was a problem hiding this comment.
yes, I will return to this section.
| } | ||
|
|
||
| if (!active_proc){ | ||
| kprintf("[LAUNCHER] Failed to read ELF file"); |
There was a problem hiding this comment.
Keep the error messages shown here, since they're the only indication of what went wrong
| dest[i] = ((uint8_t *)content)[i]; | ||
| } | ||
|
|
||
| // Extract and display the ASCII strings that USER.ELF would have printed |
There was a problem hiding this comment.
I left a message there to come back and fix the filesystem part. I'll delete it at some point.
| fi | ||
|
|
||
| if ! command -v "mkfs.fat" >/dev/null 2>&1; then | ||
| if ! command -v "/usr/sbin/mkfs.fat" >/dev/null 2>&1; then |
There was a problem hiding this comment.
These paths should not be hardcoded. Check your $PATH to ensure you have them there, as this will break for other users
There was a problem hiding this comment.
My development operating system is OpenSUSE TW and that's why I use it that way, but I'll migrate to Manjaro in a few days. After that, I shouldn't have the problem anymore.
There was a problem hiding this comment.
You shouldn't need to switch distros to make this work, just need to add /usr/sbin to your path like:
export PATH="$PATH:/usr/sbin"for when doing development, or put that in your ~/.bashrc or equivalent to make it happen automatically. You could probably also just symlink /usr/sbin/mkfs.fat into a directory that is in your PATH if you didn't want to accidentally be able to run other stuff from /usr/sbin, though it shouldn't matter since you'd need to be root to do anything dangerous anyway.
There was a problem hiding this comment.
Thanks @codebrainz.
I known this issue regarding mkfs.fat, but i have other issue with QEMU and SDL options in OpenSUSE TW.
That's why I would like to change to Manjaro.
| #include "math/math.h" | ||
| #include "std/string.h" | ||
| #include "syscalls/syscalls.h" | ||
| #include "process/syscall.h" // For SYS_POWEROFF |
There was a problem hiding this comment.
Comments (in the whole PR) are largely unnecessary. The code is self explanatory
There was a problem hiding this comment.
I'll keep that comment in mind.
|
Also, shutdown seems to crash when pressing the shortcut. |
It is written partly by me and partly by Qwen Coder AI. |
|
As stated in the contributing guidelines of the project, use of AI is discouraged and PRs that appear to be largely made using AI will be rejected. Thank you for your contribution but the new functionality does appear to be largely written by AI, which is what I believe leads to some of the more inconsistent aspects of the code submitted. |
Description:
Added power management system with power_off() and reboot() functions
Implemented Ctrl+Alt+Del for system shutdown
Added Ctrl+Alt+Esc for system reboot
Added syscalls for power management (60: poweroff, 61: reboot)
Updated login screen with shutdown hint
Added necessary key code definitions