INB(1)
π INB β the I/O port bestie page π
okay so this is INB(1), which lives in the I/O Ports corner of your manual, and it's the whole inb, outb, inw, outw, inl, outl family. Six commands, one vibe: talking directly to your hardware's I/O ports. No middleman. No cap. π₯
β¨ NAME β¨
inb, outb, inw, outw, inl, outl β access I/O ports
πΈ SYNOPSIS πΈ
inb ADDRESS
inw ADDRESS
inl ADDRESS
outb ADDRESS DATA
outw ADDRESS DATA
outl ADDRESS DATA
π EXAMPLES π
inb 0x278
outw 0x440 0xffff
π DESCRIPTION π
These commands enable command line and script access directly to I/O ports on PC hardware. Like, you're literally reaching into the machine and poking the ports. Iconic behaviour honestly. π
The "inb", "inw" and "inl" commands perform an input (read) operation on the given I/O port, and print the result. Read it and weep (affectionately).
The "outb", "outw" and "outl" commands perform an output (write) operation to the given I/O port, sending the given data. β οΈ And bestie, listen: note that the order of the parameters is ADDRESS DATA. Address first, then data. Not the other way. Do not freestyle this one, iykyk. π
The size of the operation is selected according to the suffix, with "b" meaning byte, "w" meaning word (16 bits) and "l" meaning long (32 bits). So the letter at the end is literally telling you how chunky this operation is. π
Port numbers are in the range 0-0xffff. And no, we don't support access to memory mapped devices β that's just not the serve here, periodt.
Hexadecimal numbers (prefixed by "0x"), decimal numbers, and octal numbers (prefixed by 0), are allowed as parameters. So go off with whatever number format your heart desires. β¨
π¦ RETURN FROM "IN" OPERATIONS π¦
The value read from the port by an "in" operation is normally printed in decimal. Basic. Classic. We love her.
Use the --hex option to print the result as hexadecimal ("0x" prefix is NOT printed). π¨ Not printed!! The prefix does not come. Don't @ me, that's just the rule.
Use the --code option to turn the result into an exit status. Note that Unix/shell can only reliably return exit status in the range 0-0x7f, so this is not particularly useful in practice. Like, the vibe is there but the practicality is lowkey not. π₯² Still, it's an option and she's valid.
π TYPE AND SIZE OF OPERATION π
The type and size of the operation is normally determined by the name of the command, eg. "inb" is a read operation of 1 byte. The command name already ate, basically. π
You can override this by using the --read, --write and/or --size N options. For "--size N", "N" should be 1, 2 or 4 meaning byte, word and long respectively. 1 = byte, 2 = word, 4 = long. Memorise it, bestie, it's giving cheat sheet. π
π PERMISSIONS π
You would normally need to be root or have the "CAP_SYS_RAWIO" capability in order to run these commands. Main character privileges required. Regular users, this is not your moment unfortunately. π
π WARNING π
Using these commands can cause Bad Things to happen to your hardware.
Capital-B, capital-T Bad Things. To your actual physical hardware. π« This is the part where I hold your hand and say: know what you're doing before you send data into a port. Fr fr.
π SEE ALSO π
iopl(2)mem(4)- <http://et.redhat.com/~rjones/ioport>
- <http://www.faqs.org/docs/Linux-mini/IO-Port-Programming.html>
π AUTHORS π
Richard W.M. Jones <rjones @ redhat . com>
β COPYRIGHT β
(C) Copyright 2009 Red Hat Inc., <http://et.redhat.com/~rjones/ioport>.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
and that's the whole page, bestie π«Ά this was ioport-1.2, dated 2018-01-06, and it's the INB(1) manual page β go read it again if you forgot the ADDRESS DATA order. I know you did. ππ
π¦ where this page comes from
- ubuntu jammy: ioport 1.2-1 Β· GPL-2.0-or-later
- ubuntu noble: ioport 1.2-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms