# @name I2C write in background test on slave device # @desc I2C write in background test on slave device # @notes There is a default slave device for each platform. Its address can be # found in 'get_i2c_slave_addr'. If you pass slave device name, this # script can return the addr for that slave device # @requires i2c/non_eeprom I2C_L_FUNC_W_BG_SETGET source 'common.sh'; SLAVE_ADDRESS=`get_i2c_slave_addr.sh` || die "error getting slave address for i2c: $SLAVE_ADDRESS"; REGOFFSET=`get_i2c_slave_regoffset.sh` || die "error getting slave regoffset"; REGVALUE=`get_i2c_slave_regvalue.sh` || die "error getting slave regvalue"; I2CBUS=`get_i2cbus_number.sh` || die "error getting i2cbus number: $I2CBUS"; do_cmd "i2cset -y "$I2CBUS" "$SLAVE_ADDRESS" "$REGOFFSET" "$REGVALUE" "; do_cmd "i2cset -y "$I2CBUS" "$SLAVE_ADDRESS" "$REGOFFSET" "$REGVALUE" &" ; PID="$!"; echo "pid: $PID"; wait $PID && echo 0 || echo 1