forked from jetsonhacks/logitech-f710-module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-module.sh
executable file
·55 lines (45 loc) · 1.79 KB
/
install-module.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# Copy the Logitech HID module with F710 support to the lib/module location
# Which device is root mounted?
# We want to check if this is on the eMMC/SD Card (boot device) or if the rootfs has been
# pivoted
ROOT_DEVICE=$( findmnt -n -o SOURCE --target / )
echo "Installing on root device: $ROOT_DEVICE"
# Read version
JETSON_L4T_STRING=$(dpkg-query --showformat='${Version}' --show nvidia-l4t-core)
# extract version - remove build info
JETSON_L4T_ARRAY=$(echo $JETSON_L4T_STRING | cut -f 1 -d '-')
# Load release and revision
JETSON_L4T_RELEASE=$(echo $JETSON_L4T_ARRAY | cut -f 1 -d '.')
JETSON_L4T_REVISION=${JETSON_L4T_ARRAY#"$JETSON_L4T_RELEASE."}
# Write Jetson description
JETSON_L4T="$JETSON_L4T_RELEASE-$JETSON_L4T_REVISION"
JETSON_L4T_FIXED=bin/l4t-${JETSON_L4T_ARRAY//./-}
echo "Installing from: $JETSON_L4T_FIXED"
INSTALL_DIRECTORY=/lib/modules/$(uname -r)/kernel/drivers/hid
cd $JETSON_L4T_FIXED
MAGICVERSION=$(modinfo hid-logitech.ko | grep vermagic)
MODULEVERSION=$(echo $MAGICVERSION | cut -d " " -f 2)
KERNELVERSION=$(uname -r)
if [ "$MODULEVERSION" == "$KERNELVERSION" ]
then
echo "Kernel and Module Versions Match; Installing ..."
else
echo "The Kernel version does not match the Module Version"
echo "Kernel Version: " $KERNELVERSION
echo "Module Version: " $MODULEVERSION
while true; do
read -p "Would you still like to install the module? [Y/n] " response
case $response in
[Yy]* ) break ;;
[Nn]* ) exit;;
* ) echo "Please answer Yes or no. " ;;
esac
done
# The module version did not match the kernel version, but user selected to install anyway
echo "You may have to force the module to be inserted, i.e. "
echo "$ sudo modprobe -f hid-logitech"
fi
sudo cp -v hid-logitech.ko $INSTALL_DIRECTORY
sudo depmod -a
echo "Installed hid-logitech Module"