USB 3.0 is on the way

I am anticipating the USB interface for my BusyBox Mitochondrial DNA operating system. In the process I am creating utilities in antfarmgl that combine some functionality to tell me what is happening at the machine, kernel, device, library, and user level of USB and the devices and hubs that connect there. This is a little script I was testing and most of it just comes from the usbutils source package. "lsusb -v", in its verbose mode provides different information than through the streaming video interface and I suspect that name lengths are limited within the string handlers. Here is my script, which just lists some hub information and gives a person some idea of how the overall structure of the hardware is connected.


#!/usr/bin/env bash class_decode() { local class=$1 # v4: in hex case $class in "00") echo ">ifc " ;; "01") echo "audio" ;; "02") echo "commc" ;; "03") echo "HID " ;; "05") echo "phys " ;; "06") echo "image" ;; "07") echo "print" ;; "08") echo "mstor" ;; "09") echo "hub " ;; "0a") echo "comdt" ;; "0b") echo "smcrd" ;; "0d") echo "cosec" ;; "0e") echo "video" ;; "0f") echo "perhc" ;; "dc") echo "diagd" ;; "e0") echo "wlcon" ;; "ef") echo "misc " ;; "fe") echo "app. " ;; "ff") echo "vend." ;; "*") echo "unk. " ;; esac } # This will display a formatted indicator file contents print_string() { file=$1 name=$2 if [ -f $file ]; then echo "S: $name=`cat $file`" fi } #This simply shows the raw directories print_device_raw(){ # does some equates on the passed values on the stack local devpath=$1 local level=$3 #Starts as 0 local parent=$2 local count=$4 # "IF" the path is not a directory, skip this # Actually the displayed logic is "[ ?Directory True] ||=or Return" # The spacing is important in shell # The dash of the command must be separated by a space [ -d $devpath ] || return printf " $1\n" # now go into that directory cd $devpath # Notice here that it is using back ticks # That means it will execute the command local busnum=`cat busnum` local devnum=`cat devnum` printf "Bus number is $busnum\n" printf "Device number on bus is $devnum\n" if [ $level -gt 0 ]; then port=$((${devpath##*[-.]} - 1)) else port=0 fi printf "Port is $port and level is $level\n" speed=`cat speed` maxchild=`cat maxchild` printf "Here are the hubs and their information.\n" printf "T: Bus=%02i Lev=%02i Prnt=%02i \ Port=%02i Cnt=%02i Dev#=%3i BUS Speed=%-5s \ Bits per second MxCh=%2i\n" \ $busnum $level $parent $port $count $devnum \ $speed $maxchild ver=`cat version` devclass=`cat bDeviceClass` devsubclass=`cat bDeviceSubClass` devprotocol=`cat bDeviceProtocol` maxps0=`cat bMaxPacketSize0` numconfigs=`cat bNumConfigurations` classname=`class_decode $devclass` printf "D: Ver=%5s Cls=%s(%s) Sub=%s \ Prot=%s MxPS=%2i #Cfgs=%3i\n" \ $ver $devclass "$classname" \ $devsubclass $devprotocol \ $maxps0 $numconfigs vendid=`cat idVendor` prodid=`cat idProduct` revmajor=`cat bcdDevice | cut -c 1-2` revminor=`cat bcdDevice | cut -c 3-4` printf "P: Vendor=%s ProdID=%s Rev=%2i.%02i\n" \ $vendid $prodid $revmajor $revminor print_string manufacturer "Manufacturer" print_string product Product print_string serial SerialNumber } # This is where the script starts # Everything above is definitions and procedures printf "PCI links of the USB channels and hubs.\n" ls -la /sys/bus/usb/devices/usb* printf "USB 1 and 2 diretory links.\n" # start with a title for device in /sys/bus/usb/devices/usb* do print_device_raw $device 0 0 0 printf "\n" done

The code should be fairly obvious and I commented some stuff for the sake of describing how the different shell script parts interact and this is just a simple thing I played with to get an idea of what I wanted to include in the project. I have arranged things in a series of indexed "pages" which deal with all types of object sets that include USB structures, files, openGL capabilities, speed tests, timing, CPU information, graphics card tests, various ontologies, code variables, code objects, and generally anything that is in the program or connected to the program has a clickable list item that describes in detail how it works or information on its structural relationships or even origins and code.

0 comments:

Contributors

Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen