Skip to content
Snippets Groups Projects
Commit e08f4938 authored by Marc-Oliver Westerburg's avatar Marc-Oliver Westerburg Committed by Norman Stetter
Browse files

ltp-guf-test (aio): added support for absolute device-names (refs #39960)

* @aio@ tool can now use device-names of the form
** e.g. @iio:device0/in_voltage_raw@ to specify devices relative to @/sys/bus/iio/devices/@, as before
** or e.g. @/dev/ain1/in_voltage_raw@ to specify absolute device names

Change-Id: Id0e38ea614e03b3f3363209a5ce3af21c5a7fb0a
parent 12b50528
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,10 @@
#-----------------------------------------------------------------------------#
# Vorm Start einmal:
# source /opt/ltp/setup.sh
#
# setup.sh:
###########
# export PATH=$PATH:/opt/ltp/testcases/bin
# export DISPLAY=:0
......@@ -25,7 +29,7 @@ Testimage_display bball -f -l 0.1 &
Touchtest_remove_socket rm -f /opt/touch_tst_socket
Touchtest_start touchmon -d -i /dev/input/event0 -s /opt/touch_tst_socket -p 0
Network_start iptables -P INPUT ACCEPT; iptables -P OUTPUT ACCEPT;
Network_start iptables -P INPUT ACCEPT; iptables -P OUTPUT ACCEPT; iptables -P FORWARD ACCEPT;
#Network_eth0 ifconfig lan1 add 192.168.1.1
#Network_eth1 ifconfig lan2 add 192.168.2.1
#Network_eth2 ifconfig lan3 add 192.168.3.1
......@@ -37,7 +41,7 @@ Buzzer_start echo 0 >/sys/class/pwm/pwmchip3/export; echo 333333 >/sys/class/
#LED_Power_start echo 0 >/sys/class/pwm/pwmchip2/export; echo 2000000 >/sys/class/pwm/pwmchip2/pwm0/period; echo 1000000 >/sys/class/pwm/pwmchip2/pwm0/duty_cycle; echo 1 >/sys/class/pwm/pwmchip2/pwm0/enable
#LED_Error_start echo 0 >/sys/class/pwm/pwmchip1/export; echo 2000000 >/sys/class/pwm/pwmchip1/pwm0/period; echo 1000000 >/sys/class/pwm/pwmchip1/pwm0/duty_cycle; echo 1 >/sys/class/pwm/pwmchip1/pwm0/enable
Ambient_Proximity ambprox_setup.sh
USB_stick_start ubus call board enable '{"name": "usb"}'
USB_stick_start ubus call board enable '{"name": "usb"}'; mount -o remount,rw /tmp/E26F-BE71;
#-----------------------------------------------------------------------------#
# TESTCASES #
......@@ -46,17 +50,17 @@ GPIO1 gpio_inout -o /sys/devices/soc0/gpio_export_keypad_f
GPIO2 gpio_inout -o /sys/devices/soc0/gpio_export_keypad_fixed_out/DIG_OUT_2 -g /sys/devices/soc0/gpio_export_keypad_fixed_in/DIG_IN2 -d 1
Temp lm73temp -n lm75
#MMC_write_25kB if [ -b /dev/mmcblk1 ]; then df /media/mmcblk1/ | grep mmcblk1 || mount /dev/mmcblk1 /media/mmcblk1; fwrite -q -n /media/mmcblk1/testfile -b 25000 -d -i 1; else false; fi
#USB_stick_1_write_25kB if [ -b /dev/sda ]; then df /tmp/E26F-BE71/ | grep sda || mount /dev/sda /tmp/E26F-BE71/; fwrite -q -n /tmp/E26F-BE71/testfile -b 60000 -d -i 1; else false; fi
USB_stick_1_write_25kB if [ -b /dev/sda ]; then df /tmp/E26F-BE71/ | grep sda || mount -o rw /dev/sda /tmp/E26F-BE71/; fwrite -q -n /tmp/E26F-BE71/testfile -b 60000 -d -i 1; else false; fi
#Network_eth0 iptest -q -g 192.168.1.100 -n 2000 -w 50
#Network_eth1 iptest -q -g 192.168.2.100 -n 2000 -w 50
#Network_eth2 iptest -q -g 192.168.3.100 -n 2000 -w 50
RS485_BB2 rs485pingpong -b 32 -r 6 -s 4800 -x 100 -o 1 -d /dev/xye2 -n
RS485_34 rs485pingpong -b 32 -r 6 -s 4800 -x 100 -o 1 -d /dev/xye4 -n
#RS485_5 rs485pingpong -b 32 -r 6 -s 57600 -x 100 -o 1 -d /dev/rs485
RS485_5 rs485pingpong -b 32 -r 6 -s 57600 -x 100 -o 1 -d /dev/rs485 -n
Touch touchmon -z -r /opt/touch_tst_socket
Ambient i2c -d /dev/i2c-2 -s 0x60 -a 0x0b -n 0 -x 65536 -m 8 -l 2 -i 10
Proximity i2c -d /dev/i2c-2 -s 0x60 -a 0x08 -n 0 -x 65536 -m 8 -l 2 -i 10
AnalogIO aio -s iio:device0/in_voltage_raw -o iio:device2/out_voltage0_raw -g 0.078125 -e 0.4 -v -m 5 -i 5;
AnalogIO aio -s /dev/ain1/in_voltage_raw -o /dev/aout1/out_voltage0_raw -e 0.4 -v -m 5 -i 5;
Buzzer echo 1 >/sys/class/pwm/pwmchip3/pwm0/enable; usleep 100000; echo 0 >/sys/class/pwm/pwmchip3/pwm0/enable
Wait sleep 0.9
......
......@@ -133,11 +133,23 @@ double getscale(char *device_name, char *scale_name)
goto error;
char *iio_dev = dirname(temp);
name = calloc(sizeof(char), strlen(conf_iio_path)+strlen(iio_dev)+strlen(scale_name)+2);
if (!name)
goto error;
sprintf(name, "%s%s/%s", conf_iio_path, iio_dev, scale_name);
if (device_name[0] != '/') {
// assume relative paths are relative to conf_iio_path
name = calloc(sizeof(char), strlen(conf_iio_path)+strlen(iio_dev)+strlen(scale_name)+2);
if (!name)
goto error;
sprintf(name, "%s%s/%s", conf_iio_path, iio_dev, scale_name);
} else {
// assume absolute paths are directly usable devices
name = calloc(sizeof(char), strlen(iio_dev)+strlen(scale_name)+2);
if (!name)
goto error;
sprintf(name, "%s/%s", iio_dev, scale_name);
}
fd = fopen(name, "r");
if (!fd)
goto error;
......@@ -185,14 +197,26 @@ FILE *opendevice(char *device_name, const char *mode)
return fd;
}
name = calloc(sizeof(char), strlen(conf_iio_path)+strlen(device_name)+1);
if (!name) {
tst_brkm(TBROK, cleanup,
"Unable to open the IIO device %s. Error: %d, %s",
device_name, errno, strerror(errno));
return fd;
if (device_name[0] != '/') {
// assume relative paths are relative to conf_iio_path
name = calloc(sizeof(char), strlen(conf_iio_path)+strlen(device_name)+1);
if (!name) {
tst_brkm(TBROK, cleanup,
"Unable to open the IIO device %s. Error: %d, %s",
device_name, errno, strerror(errno));
return fd;
}
sprintf(name, "%s%s", conf_iio_path, device_name);
} else {
// assume absolute paths are directly usable devices
name = strdup(device_name);
if (!name) {
tst_brkm(TBROK, cleanup,
"Unable to open the IIO device %s. Error: %d, %s",
device_name, errno, strerror(errno));
return fd;
}
}
sprintf(name, "%s%s", conf_iio_path, device_name);
fd = fopen(name, mode);
if (!fd) {
tst_brkm(TBROK, cleanup,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment