usb_driver: add a script to install Cypress usb driver
The new DVKs of the cc8mn, cc8mm and ccmp1 have a new ftdi usb to serial chip that is recognized as a thermal device by default. With the install_usb_driver.sh script this driver is replaced to a USB to serial driver. This script is included for the needed platforms in the zip installer provided in the getting started. https://onedigi.atlassian.net/browse/DEL-8126 Signed-off-by: Francisco Gil <francisco.gilmartinez@digi.com>
This commit is contained in:
parent
8c1b0f8f9e
commit
9cd5ae591d
|
|
@ -65,4 +65,12 @@ _EOF_
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
generate_installer_zip:append:ccimx8m () {
|
||||||
|
INSTALLER_FILELIST=${META_DIGI_SCRIPTS}/install_usb_driver.sh
|
||||||
|
}
|
||||||
|
|
||||||
|
generate_installer_zip:append:ccmp1 () {
|
||||||
|
INSTALLER_FILELIST=${META_DIGI_SCRIPTS}/install_usb_driver.sh
|
||||||
|
}
|
||||||
|
|
||||||
IMAGE_POSTPROCESS_COMMAND += "generate_installer_zip; "
|
IMAGE_POSTPROCESS_COMMAND += "generate_installer_zip; "
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ LAYERDEPENDS_digi-dey += "openembedded-layer networking-layer webserver qt5-laye
|
||||||
|
|
||||||
LAYERSERIES_COMPAT_digi-dey = "kirkstone"
|
LAYERSERIES_COMPAT_digi-dey = "kirkstone"
|
||||||
|
|
||||||
|
META_DIGI_SCRIPTS = "${LAYERDIR}/../scripts"
|
||||||
|
|
||||||
# Digi's General and Open Source license agreements
|
# Digi's General and Open Source license agreements
|
||||||
DIGI_EULA_FILE = "${LAYERDIR}/DIGI_EULA"
|
DIGI_EULA_FILE = "${LAYERDIR}/DIGI_EULA"
|
||||||
DIGI_OPEN_EULA_FILE = "${LAYERDIR}/DIGI_OPEN_EULA"
|
DIGI_OPEN_EULA_FILE = "${LAYERDIR}/DIGI_OPEN_EULA"
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,73 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#===============================================================================
|
||||||
|
#
|
||||||
|
# Copyright (C) 2022 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:
|
||||||
|
# Script to install the driver of the usb serial console.
|
||||||
|
#===============================================================================
|
||||||
|
|
||||||
|
# Exit on any error
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Unload the selected module
|
||||||
|
unload_module()
|
||||||
|
{
|
||||||
|
if grep -qs "^${1}" /proc/modules; then
|
||||||
|
printf "Module ${1} loaded, unloading the module.\n"
|
||||||
|
rmmod "${1}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create rule for the Cypress USB driver
|
||||||
|
create_rule()
|
||||||
|
{
|
||||||
|
RULE_PATH=/etc/udev/rules.d/90-cyusb.rules
|
||||||
|
if [ ! -f "$RULE_PATH" ]; then
|
||||||
|
printf "Rule \"$RULE_PATH\" doesn't exist, creating a new one.\n"
|
||||||
|
printf "# Cypress USB driver for FX2 and FX3 (C) Cypress Semiconductor Corporation / ATR-LABS" | tee ${RULE_PATH} > /dev/null
|
||||||
|
printf "# Rules written by V. Radhakrishnan ( rk@atr-labs.com )" | tee -a ${RULE_PATH} > /dev/null
|
||||||
|
printf "# Cypress USB vendor ID = 0x04b4" | tee -a ${RULE_PATH} > /dev/null
|
||||||
|
printf "KERNEL==\"*\", SUBSYSTEM==\"usb\", ENV{DEVTYPE}==\"usb_device\", ACTION==\"add\", ATTR{idVendor}==\"04b4\", MODE=\"666\"" | tee -a ${RULE_PATH} > /dev/null
|
||||||
|
printf "KERNEL==\"*\", SUBSYSTEM==\"usb\", ENV{DEVTYPE}==\"usb_device\", ACTION==\"remove\", TAG==\"cyusb_dev\"" | tee -a ${RULE_PATH} > /dev/null
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Blacklist the selected module
|
||||||
|
blacklist()
|
||||||
|
{
|
||||||
|
BLACKLISTH_PATH=/etc/modprobe.d/blacklist.conf
|
||||||
|
if [ ! -f "$BLACKLISTH_PATH" ]; then
|
||||||
|
printf "File \"$BLACKLISTH_PATH\" doesn't exist, creating a new one.\n"
|
||||||
|
printf "blacklist ${1}" | tee ${BLACKLISTH_PATH} > /dev/null
|
||||||
|
else
|
||||||
|
printf "File \"$BLACKLISTH_PATH\" exists, checking if the rule is already there.\n"
|
||||||
|
if grep -Fq "${1}" $BLACKLISTH_PATH; then
|
||||||
|
printf "Rule for ${1} found.\n"
|
||||||
|
else
|
||||||
|
printf "Rule for ${1} not found. Adding ${1} to the blacklist.\n"
|
||||||
|
printf "\nblacklist ${1}" | tee -a ${BLACKLISTH_PATH} > /dev/null
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$(id -u)" != 0 ]; then
|
||||||
|
printf "This script should be run with root privileges.\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "Installing Cypress USB driver.\n"
|
||||||
|
|
||||||
|
create_rule
|
||||||
|
blacklist "cytherm"
|
||||||
|
|
||||||
|
unload_module "cytherm"
|
||||||
|
unload_module "cdc_acm"
|
||||||
|
|
||||||
|
printf "Please plug/unplug your usb device to be recognized.\n"
|
||||||
Loading…
Reference in New Issue