Simple IOKit wrapper in CLI form, for use in scripts or learning.
acidprime/system-type
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
master
Could not load branches
Nothing to show
Could not load tags
Nothing to show
{{ refName }}
default
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
-
Clone
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more about the CLI.
- Open with GitHub Desktop
- Download ZIP
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
This little binary will tell you if you have a Laptop or Desktop. It reads this value using the system-type in IOKit (IOPlatformExpertDevice). You can parse this value your self using the ioreg (-l) command but Its not formatted well, so I decided to make this as its a pretty common request. For instance I once had a school district that wanted to turn off wireless on all Desktops as they were having MYNAME(37) bonjour name conflict issues. There is a little example.command shell script to show you the two ways you would use this in your scripts. laptops are value 2 (exit 1) and Desktops are value 1 (exit 0). The exit values allow you to use standard logic built-in to run the command and use its exit value. Or if you think thats lame you can parse the text. To each there own but I like exit values Known Issues: As I recall this does not cover PowerPC machines, but I have not seen an intel that does not use this value. Maybe iPad 3 will be 3 ;) To Do: I will make a little installer for it as some point and put it in /usr/local/bin/system-type Could use some options as well such as controlling behaviour Maybe XML output, and put some other values? Replacement for: #!/bin/bash declare -x awk="/usr/bin/awk" declare -x ioreg="/usr/sbin/ioreg" # Intel and future systems test declare IOREG="$("$ioreg" -l | "$awk" 'BEGIN {FS="[<>]"} /.*\"system-type\".=./{ systype=$2 if ( systype == 1 ) { print "D" ; exit 0 } # System type 1 is a Desktop else if ( systype == 2 ) { print "L" ; exit 0 } # System type 2 is a Laptop }')"
About
Simple IOKit wrapper in CLI form, for use in scripts or learning.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published