-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First pull request with several commits to review. #20
base: master
Are you sure you want to change the base?
Conversation
…h is a directory, then checks if the extensions on windows are either .exe or .com, if it isn't running on windows check for 0111 file permission bits.
…_windows.go file.
…g the CfgMgr32.dll library, and the return value of CM_Open_Class_Key_ExW is now checked to ensure that the function succeeded in opening the registry key. Additionally, the code now uses syscall.UTF16ToString instead of string to convert the byte slices to strings, as this is a safer way to handle Unicode strings.
…ework. The C library and header are both part of the IOKit framework and are included by specifying -framework IOKit as a linker flag. The enumerateDevices() function opens an I/O Kit registry entry for USB devices, creates a matching dictionary for USB devices, and iterates over USB devices to get their names and IDs. The function then converts the names and IDs to Go strings and adds them to a device list.
…nction. This commit uses MustFindProc to find the ExitWindowsEx function, and then calls it with the appropriate arguments to initiate a forced shutdown. The commit also includes a custom error message using fmt.Errorf function. The function takes two parameters: the first specifies the shutdown operation, and the second specifies the shutdown reason. If ExitWindowsEx returns 0, an error occurred.
…only. The function attempts to call the reboot system call with the LINUX_REBOOT_CMD_POWER_OFF command first and, if that fails, with the LINUX_REBOOT_CMD_HALT command. If both calls fail, the function returns an error.
… using the syscall package. The function first tries to call the Reboot system call with the RB_POWEROFF command, which should initiate an immediate shutdown of the system. If that fails, it tries to call the Reboot system call with the RB_HALT command, which should initiate a system halt. If both of these system calls fail, the function returns an error.
…to clarify what it does.
Thanks for the PR, it's about time this repository saw some love. I'll try and get to it this week. |
…n stat lsusb doesn't work on Ubuntu 22.10, the machine I am testing this on.
Hey @flowchartsman I just wanted to check in with you to see if you got a chance to look at the changes yet? I know you are probably really busy so understand if you haven't. Ozfive |
Not yet, it's... a lot |
I'm sorry. :( In the future I will only submit single feature/few commit pull requests. I was just on a roll... |
Hi this is my first pull request here on Github. I randomly found your deadman application and decided to contribute some work towards it. The commits speak for themselves. Some major things to point out are the support for FreeBSD and adjustments to how USB devices are enumerated as well as direct system calls for the OSs for shutdown operations. If you could verify the functionality for the Operating Systems you do have that would be great!