#!/bin/sh #=============================================================================== # # accelerometer # # Copyright (C) 2012-2013 by Digi International Inc. # All rights reserved. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License version 2 as published by # the Free Software Foundation. # # !Description: Load accelerometer calibration # #=============================================================================== DEL_PLATFORM="$(cat /sys/kernel/machine/name)" ## Per-platform accelerometer data # while read _pl _name _i2c; do eval "${_pl}_name=\"${_name}\"" eval "${_pl}_i2c=\"${_i2c}\"" done<<-_EOF_ ccimx51 mma7455l 1-001d ccimx53 mma7455l 2-001d _EOF_ eval SYSFS_I2C_PATH="/sys/bus/i2c/drivers/\${${DEL_PLATFORM}_name}/\${${DEL_PLATFORM}_i2c}" SYS_ACCEL_GSELECT="${SYSFS_I2C_PATH}/gSelect" SYS_ACCEL_CALIBRATION="${SYSFS_I2C_PATH}/calibration" CALIBRATION_CFG="/etc/accel_calibration" if [ -f "${SYS_ACCEL_GSELECT}" -a -f "${SYS_ACCEL_CALIBRATION}" -a -f "${CALIBRATION_CFG}" ]; then read g x y z < "${CALIBRATION_CFG}" echo -n "${g}" > "${SYS_ACCEL_GSELECT}" echo -n "${x} ${y} ${z}" > "${SYS_ACCEL_CALIBRATION}" fi