# Syntax is:
# * uuid2dev $FILE
# * change_uuid $FILE $DEV_SDCARD
+# * switch2device $SDMUX
+# * switch2testserver $SDMUX
+# * restart_device $SDMUX [$DELAY]
+# * sdmux_init $SDMUX
+# * change_id $SDMUX $NEWID
#
# Author: Aleksander Mistewicz <a.mistewicz@samsung.com>
echo "${NEW_UUID}" > "${FILE}"
}
+
+switch2device() {
+ SDMUX="$1"
+ test -n "${SDMUX}" || die "Missing argument: sdmux!"
+ sudo sd-mux-ctrl -e "${SDMUX}" -d || die "Error returned by sd-mux-ctrl: switch2device failed!"
+}
+
+switch2testserver() {
+ SDMUX="$1"
+ test -n "${SDMUX}" || die "Missing argument: sdmux!"
+ sudo sd-mux-ctrl -e "${SDMUX}" -s ||
+ die "Error returned by sd-mux-ctrl: switch2testserver failed!"
+}
+
+restart_device() {
+ SDMUX="$1"
+ DELAY="$2"
+ test -n "${SDMUX}" || die "Missing argument: sdmux!"
+ test -n "${DELAY}" || DELAY="2000"
+ sudo sd-mux-ctrl -e "${SDMUX}" -m "${DELAY}" -c ||
+ die "Error returned by sd-mux-ctrl: restart_device failed!"
+}
+
+sdmux_init() {
+ SDMUX="$1"
+ test -n "${SDMUX}" || die "Missing argument: sdmux!"
+ sudo sd-mux-ctrl -e "${SDMUX}" -t ||
+ die "Error returned by sd-mux-ctrl: sdmux_init failed!"
+}
+
+change_id() {
+ SDMUX="$1"
+ NEWID="$2"
+ test -n "${SDMUX}" || die "Missing argument: sdmux!"
+ test -n "${NEWID}" || die "Missing argument: newid!"
+ if [ "${SDMUX}" != "${NEWID}" ]; then
+ sudo sd-mux-ctrl -e "${SDMUX}" -r "${NEWID}" ||
+ die "Error returned by sd-mux-ctrl: change_id failed!"
+ fi
+}