First pull request with several commits to review.#20
Open
ozfive wants to merge 23 commits intoflowchartsman:masterfrom
Open
First pull request with several commits to review.#20ozfive wants to merge 23 commits intoflowchartsman:masterfrom
ozfive wants to merge 23 commits intoflowchartsman:masterfrom
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.
Owner
|
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.
Author
|
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 |
Owner
|
Not yet, it's... a lot |
Author
|
I'm sorry. :( In the future I will only submit single feature/few commit pull requests. I was just on a roll... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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!