Skip to content

Commit 4438b1d

Browse files
committed
scripts: Install hdmi2usb modeswitch.
Working on timvideos#263.
1 parent 6e11ab3 commit 4438b1d

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

scripts/enter-env.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,20 @@ function check_import {
8787
fi
8888
}
8989

90+
function check_import_version {
91+
MODULE=$1
92+
EXPECT_VERSION=$2
93+
ACTUAL_VERSION=$(python3 -c "import $MODULE; print($MODULE.__version__)")
94+
if echo "$ACTUAL_VERSION" | grep -q $EXPECT_VERSION > /dev/null; then
95+
echo "$MODULE found at $ACTUAL_VERSION"
96+
return 0
97+
else
98+
echo "$MODULE (version $EXPECT_VERSION) *NOT* found!"
99+
echo "Please try running the $SETUP_DIR/get-env.sh script again."
100+
return 1
101+
fi
102+
}
103+
90104
# Install and setup conda for downloading packages
91105
echo ""
92106
echo "Checking modules from conda"
@@ -118,8 +132,10 @@ check_version sdcc $SDCC_VERSION || return 1
118132
check_version openocd 0.10.0-dev || return 1
119133

120134
# hexfile for embedding the Cypress FX2 firmware.
121-
check_import hexfile
135+
check_import_version hexfile $HEXFILE_VERSION
122136

137+
# Tool for changing the mode (JTAG/Serial/etc) of HDMI2USB boards
138+
check_import_version hdmi2usb.modeswitch $HDMI2USB_MODESWITCH_VERSION
123139
# git submodules
124140
echo ""
125141
echo "Checking git submodules"

scripts/get-env.sh

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,20 @@ function check_import {
121121
fi
122122
}
123123

124+
function check_import_version {
125+
MODULE=$1
126+
EXPECT_VERSION=$2
127+
ACTUAL_VERSION=$(python3 -c "import $MODULE; print($MODULE.__version__)")
128+
if echo "$ACTUAL_VERSION" | grep -q $EXPECT_VERSION > /dev/null; then
129+
echo "$MODULE found at $ACTUAL_VERSION"
130+
return 0
131+
else
132+
echo "$MODULE (version $EXPECT_VERSION) *NOT* found!"
133+
echo "Please try running the $SETUP_DIR/get-env.sh script again."
134+
return 1
135+
fi
136+
}
137+
124138
# Install and setup conda for downloading packages
125139
echo ""
126140
echo "Install modules from conda"
@@ -166,7 +180,13 @@ check_version openocd 0.10.0-dev
166180
(
167181
pip install --upgrade git+https://github.com/mithro/hexfile.git
168182
)
169-
check_import hexfile
183+
check_import_version hexfile $HEXFILE_VERSION
184+
185+
# Tool for changing the mode (JTAG/Serial/etc) of HDMI2USB boards
186+
(
187+
pip install --upgrade git+https://github.com/timvideos/HDMI2USB-mode-switch.git
188+
)
189+
check_import_version hdmi2usb.modeswitch $HDMI2USB_MODESWITCH_VERSION
170190

171191
# git submodules
172192
echo ""

scripts/settings.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ BUILD_DIR=$TOP_DIR/build
88
THIRD_DIR=$TOP_DIR/third_party
99
CONDA_DIR=$BUILD_DIR/conda
1010

11+
# Python module versions
12+
HDMI2USB_MODESWITCH_VERSION=0.0.0
13+
HEXFILE_VERSION=0.1
14+
15+
# Conda package versions
1116
BINUTILS_VERSION=2.26
1217
GCC_VERSION=4.9.3
1318
SDCC_VERSION=3.5.0

0 commit comments

Comments
 (0)