= Gateworks Linux Example Test Commands = Following is a list of commands that are available in the BSP from Gateworks that can be used in order to test the functionality of the product. Users can use these commands to further the functionality of there application. [=#pci] == PCI == See also: * [wiki:newport/PCIe] * [wiki:ventana/PCIe] === Find available devices on the PCI Bus === {{{#!bash lspci -v }}} == USB == === Find available devices on the USB Bus === {{{#!bash lsusb -v }}} [=#rtc] == RTC == === Read Time from RTC === {{{#!bash hwclock -r }}} === Write current Time to RTC === {{{#!bash hwclock -w }}} [=#hwmon] == HWMON == === Read Voltage === Different voltages can be read from the board, just change in0 to any of in0 - in12[[BR]] The voltages read are current voltage * 1000 {{{#!bash cat /sys/class/hwmon/hwmon0/device/in0_label cat /sys/class/hwmon/hwmon0/device/in0_input }}} === Read Temperature === The temp read is current temp * 10 {{{#!bash cat /sys/class/hwmon/hwmon0/device/temp0_input }}} === Set Fan Setpoint === The fan controller has 5 setpoints ranging from 50% on to 100% on, corresponding with fan0_point0 (50%) to fan0_poing5 (100%) === Read Current Setpoint === The setpoint read is current setpoint * 10 {{{#!bash cat /sys/class/hwmon/hwmon0/device/fan0_point0 }}} === Write new Setpoint === Value to write is new temperatore * 10 {{{ echo 450 > /sys/class/hwmon/hwmon0/device/fan0_point0 }}} [=#gpio] == GPIO == See also: * [wiki:gpio] * [wiki:OpenWrt/gpio] === Read GPIO === See a list of currentl used GPIO's: {{{#!bash cat /sys/kernel/debug/gpio }}} === Export A GPIO for user control === {{{#!bash echo 8 > /sys/class/gpio/export # export gpio 8 which will get configured as an input }}} === Set Direction of GPIO === {{{#!bash echo out > /sys/class/gpio/gpio8/value # make gpio8 an output echo in > /sys/class/gpio/gpio8/value # make gpio8 an input }}} === Set Output of GPIO === {{{#!bash echo 0 > /sys/class/gpio/gpio8/value # set gpio8 to logic low echo 1 > /sys/class/gpio/gpio8/value # set gpio8 to logic high }}} === Check GPIO === {{{#!bash cat /sys/kernel/debug/gpio # see all gpio's cat /sys/class/gpio/gpio8/value # see state of gpio8 }}} [=#i2c] == I2C == See also: * [wiki:I2C] * [wiki:linux/i2c] === Detect all available i2c devices === {{{#!bash i2cdetect -f -y 0 }}} === Read i2c address === Where "x" is the device id, and "y" is the wanted address {{{#!bash i2cget -f -y 0 x y }}} === Write i2c Address === Where "x" is the device id, and "y" is the wanted address to write and "z" is the value to write {{{#!bash i2cset -f -y 0 x y z }}} [=#kernel] == Kernel Modules == See also: * [wiki:kernel] === Find modules loaded by kernel === {{{#!bash lsmod }}}