wiki:Internal/LinuxInterface

The Little ORBIT Node Linux Interfacer:

How do I get a list of all wireless devices on a node? find /sys -name wireless -print
How do I determine the bus of the wireless device with interface named foo0? ls -l /sys/class/net/foo0/device/bus | sed -e 's#^.*/\([^/]*\)$#\1#'
How do I get the vendor id of a wireless PCI device with interface named foo0? cat /sys/class/net/foo0/device/vendor
How do I get the device id of a wireless PCI device with interface named foo0? cat /sys/class/net/foo0/device/device
How do I get the vendor and device id of a wireless USB device with interface named foo0? cat /sys/class/net/foo0/device/uevent | grep ^PRODUCT | sed -e '<redacted>'
Why is the sed expression redacted? To spare your sanity.
How do I get the MAC address of a wireless device with interface named foo0? cat /sys/class/net/foo0/address
How do I in general query and manipulate the Linux kernel's IP layer? With ip (hint: -o -f inet). Not with ifconfig.
How do I cause a moo without harming a cow? ip moo
If an interface is renamed with ip link set foo0 name bar3, will the above commands still work? Yes, file names in /sys will change to match the new name, but you will have to re-examine /sys/class/net to pick up changes, and there is no good way to lock against changes from within the kernel. Applications must negotiate changes between themselves.
How do I get a list of all hard disks on a node? find /sys/devices -name block:\*
How do I determine the overall capacity of a hard drive XdaN? cat /sys/block/XdaN/size
How do I determine how much physical memory is available? cat /proc/meminfo | grep MemTotal
How do I retrieve the serial number of the motherboard? dmidecode -s baseboard-serial-number
How do I get a list of all cpus on a node? ls -d /sys/devices/system/cpu/cpu*
How do I determine the clock speed of a cpu? cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq
Do the interface as described above work with any baseline image? No. Use 2007-12-09 or later.
Do we have reasonable assurances (!) that the interface as described above will last over the next several incarnations of the Linux wireless stack(s)? Yes. (!)
Is there a tool equivalent to ip for wireless interfaces? iw is not done yet, but when it is done, use it.
Can we replace a lot of that junk with a more general interface to /sys? Yes, but the important thing is to note the 'contract' that certain files in /sys are sure to exist on baseline images in nodes.
Last modified 16 years ago Last modified on Jan 4, 2008, 12:36:01 AM
Note: See TracWiki for help on using the wiki.