Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/linux/build/ReleaseNotes.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
--------------------------------------------------------------------------
Release Notes for
QUD Userspace Linux Installer 1.00.1.6
4/13/2026
QUD Userspace Linux Installer 1.00.1.8
6/12/2026
--------------------------------------------------------------------------

---------------------
Expand All @@ -17,6 +17,26 @@ Contacts

<host-drivers.team>: For any question or comment regarding QUD userspace driver.

-------------------------------------------------------------
New Features and CR Summary 1.00.1.8
-------------------------------------------------------------
1. Fix dpkg installing twice. moved removal of qud kernel driver
section in preinst, before payload unpack. preventing dpkg's
`Conflicts/Replaces` from triggering a second removal after files
are installed.
-------------------------------------------------------------

-------------------------------------------------------------
New Features and CR Summary 1.00.1.7
-------------------------------------------------------------
1. The libusb package is installed by the installer at a
system-defined location. DLLs are not bundled with the installer.
2. Handles removal of the legacy kernel driver and its dependencies,
replacing them with the latest userspace installer.
3. Adds support to detect and remove existing QUD installations
performed via qpm-cli.
-------------------------------------------------------------

-------------------------------------------------------------
New Features and CR Summary 1.00.1.6
-------------------------------------------------------------
Expand Down
179 changes: 94 additions & 85 deletions src/linux/pack_deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ set -euo pipefail
# -----------------------------------------------------------------------------

PKG_NAME="${PKG_NAME:-qualcomm-userspace-driver}"
VERSION="${VERSION:-1.00.1.6}"
VERSION="${VERSION:-1.00.1.8}"
ARCH="${ARCH:-linux-anycpu}"
MAINTAINER="${MAINTAINER:-Maintainer <maintainer@example.com>}"
DESCRIPTION="${DESCRIPTION:-Qualcomm userspace driver enabler for QUD devices. Installs helper scripts and executes qcom_userspace.sh during installation to enable userspace communication.}"
Expand Down Expand Up @@ -128,6 +128,18 @@ install -m 0755 "$SRC_DIR/qcom_userspace.sh" "$BUILDROOT$INSTALL_PREFIX/qcom_use
install -m 0755 "$SRC_DIR/qcom_drivers.sh" "$BUILDROOT$INSTALL_PREFIX/qcom_drivers.sh"
install -m 0755 "$SRC_DIR/QcDevDriver.sh" "$BUILDROOT$INSTALL_PREFIX/QcDevDriver.sh"

# Shared shell functions embedded into both preinst and postinst.
read -r -d '' QUD_COMMON_FUNCS <<'COMMON_FUNCS' || true
LOG_HEADER() {
{
echo ""
echo "=================================================================="
echo "[QUD_Userspace] $1"
echo "=================================================================="
} >> "$LOG_FILE" 2>&1
}
COMMON_FUNCS

# Create DEBIAN/control
cat > "$BUILDROOT/DEBIAN/control" <<EOF
Package: $PKG_NAME
Expand All @@ -139,134 +151,131 @@ Maintainer: $MAINTAINER
Depends: bash, coreutils, sed, grep, udev, kmod
Conflicts: qud
Replaces: qud
Breaks: qud
Description: $DESCRIPTION
EOF
chmod 0644 "$BUILDROOT/DEBIAN/control"

# Create DEBIAN/preinst to delete older log file and create a new one before installation
cat > "$BUILDROOT/DEBIAN/preinst" <<'EOF'
# Create DEBIAN/preinst
cat > "$BUILDROOT/DEBIAN/preinst" <<EOF
#!/usr/bin/env bash
set -e

INSTALL_PREFIX="/opt/qcom/QUD_Userspace"
LOG_FILE="$INSTALL_PREFIX/qcom_userspace_install.log"
INSTALL_PREFIX="$INSTALL_PREFIX"
LOG_FILE="\$(mktemp -t qcom_userspace_preinst_XXXXXX.log)"
chmod 0644 "\$LOG_FILE" || true

# Ensure target directory exists
mkdir -p "$INSTALL_PREFIX" || true

# Delete older file (if any) and create a new one
if [ -e "$LOG_FILE" ]; then
rm -f "$LOG_FILE" || true
fi
touch "$LOG_FILE" || true
chmod 0644 "$LOG_FILE" || true

exit 0
EOF
chmod 0755 "$BUILDROOT/DEBIAN/preinst"

# Create DEBIAN/postinst that runs qcom_userspace.sh on install
cat > "$BUILDROOT/DEBIAN/postinst" <<'EOF'
#!/usr/bin/env bash
set -e

INSTALL_PREFIX="/opt/qcom/QUD_Userspace"
LOG_FILE="$INSTALL_PREFIX/qcom_userspace_install.log"

echo "[QUD_Userspace] Ensuring script permissions..." >> "$LOG_FILE" 2>&1
chmod 0755 "$INSTALL_PREFIX/qcom_userspace.sh" \
"$INSTALL_PREFIX/qcom_drivers.sh" \
"$INSTALL_PREFIX/QcDevDriver.sh" || true
$QUD_COMMON_FUNCS

# 'qud' kernel driver package is removed by dpkg itself before postinst runs,
# via the Conflicts/Replaces/Breaks fields declared in DEBIAN/control.
# This stage will only display status and store dpkg events in the install log.
{
echo ""
echo "=================================================================="
echo "[QUD_Userspace] Checking qud kernel driver state"
echo "=================================================================="
} >> "$LOG_FILE" 2>&1

QUD_STATUS_RAW="$(dpkg-query -W -f='${Status}|${Version}' qud 2>/dev/null || true)"
QUD_STATUS_FIELD="${QUD_STATUS_RAW%%|*}"
QUD_VERSION_FIELD="${QUD_STATUS_RAW##*|}"
LOG_HEADER "Removing conflicting qud kernel driver package"
QUD_STATUS_RAW="\$(dpkg-query -W -f='\${Status}|\${Version}' qud 2>/dev/null || true)"
QUD_STATUS_FIELD="\${QUD_STATUS_RAW%%|*}"
QUD_VERSION_FIELD="\${QUD_STATUS_RAW##*|}"
QUD_DPKG_EVENT=""
QUD_DPKG_TAIL=""

if [ -r /var/log/dpkg.log ]; then
CURRENT_TXN="$(awk '/ startup /{buf=""} {buf=buf $0 ORS} END{printf "%s", buf}' /var/log/dpkg.log 2>/dev/null || true)"
if [ -n "$CURRENT_TXN" ]; then
QUD_DPKG_EVENT="$(printf '%s' "$CURRENT_TXN" \
| grep -E '(^.* (remove|purge) qud:|^.* status (config-files|not-installed|half-installed|half-configured) qud:)' \
CURRENT_TXN="\$(awk '/ startup /{buf=""} {buf=buf \$0 ORS} END{printf "%s", buf}' /var/log/dpkg.log 2>/dev/null || true)"
if [ -n "\$CURRENT_TXN" ]; then
QUD_DPKG_EVENT="\$(printf '%s' "\$CURRENT_TXN" \\
| grep -E '(^.* (remove|purge) qud:|^.* status (config-files|not-installed|half-installed|half-configured) qud:)' \\
| tail -n 1 || true)"
fi
fi

QUD_DPKG_TAIL=""
if [ -r /var/log/dpkg.log ]; then
QUD_DPKG_TAIL="$(grep -E 'qud:all|qualcomm-userspace-driver' /var/log/dpkg.log 2>/dev/null | tail -n 15 || true)"
QUD_DPKG_TAIL="\$(grep -E 'qud:all|qualcomm-userspace-driver' /var/log/dpkg.log 2>/dev/null | tail -n 15 || true)"
fi

case "$QUD_STATUS_FIELD" in
case "\$QUD_STATUS_FIELD" in
"install ok installed")
echo "[QUD_Userspace] qud (\$QUD_VERSION_FIELD) is installed — removing it now..." >> "\$LOG_FILE" 2>&1
dpkg --remove qud >> "\$LOG_FILE" 2>&1 || true
echo "[QUD_Userspace] qud kernel driver removal complete." >> "\$LOG_FILE" 2>&1
;;
"deinstall ok config-files"|"deinstall ok half-configured"|"deinstall ok half-installed")
echo "[QUD_Userspace] qud ($QUD_VERSION_FIELD) was just removed by dpkg via Conflicts/Replaces/Breaks." >> "$LOG_FILE" 2>&1
echo "[QUD_Userspace] qud (\$QUD_VERSION_FIELD) was already removed, skipping." >> "\$LOG_FILE" 2>&1
;;
*)
if [ -n "$QUD_DPKG_EVENT" ]; then
echo "[QUD_Userspace] qud was just removed by dpkg via Conflicts/Replaces/Breaks in current installation (from /var/log/dpkg.log: $QUD_DPKG_EVENT)." >> "$LOG_FILE" 2>&1
if [ -n "\$QUD_DPKG_EVENT" ]; then
echo "[QUD_Userspace] qud removal event detected in dpkg.log: \$QUD_DPKG_EVENT" >> "\$LOG_FILE" 2>&1
else
echo "[QUD_Userspace] qud driver was not installed this time, so dpkg Conflicts/Replaces/Breaks did not remove anything." >> "$LOG_FILE" 2>&1
echo "[QUD_Userspace] qud kernel driver was not installed, skipping." >> "\$LOG_FILE" 2>&1
fi
;;
esac

# Append the last few relevant lines of /var/log/dpkg.log
if [ -n "$QUD_DPKG_TAIL" ]; then
echo "" >> "$LOG_FILE" 2>&1
echo "[QUD_Userspace] /var/log/dpkg.log excerpt (last few instances of qud / qualcomm-userspace-driver events from /var/log/dpkg.log):" >> "$LOG_FILE" 2>&1
printf '%s\n' "$QUD_DPKG_TAIL" | sed 's/^/[dpkg logs] /' >> "$LOG_FILE" 2>&1
if [ -n "\$QUD_DPKG_TAIL" ]; then
echo "" >> "\$LOG_FILE" 2>&1
echo "[QUD_Userspace] /var/log/dpkg.log excerpt (last few instances of qud / qualcomm-userspace-driver events):" >> "\$LOG_FILE" 2>&1
printf '%s\n' "\$QUD_DPKG_TAIL" | sed 's/^/[dpkg logs] /' >> "\$LOG_FILE" 2>&1
fi

# Uninstall any QUD driver installed via qpm-cli
{
echo ""
echo "=================================================================="
echo "[QUD_Userspace] qpm-cli QUD uninstall (qud.internal / qud / qud.slt)"
echo "=================================================================="
} >> "$LOG_FILE" 2>&1
LOG_HEADER "qpm-cli QUD uninstall (qud.internal / qud / qud.slt)"
if command -v qpm-cli >/dev/null 2>&1; then
QUD_INTERNAL_VERSION="$(qpm-cli --info qud.internal 2>/dev/null | grep "Installed" | awk '{printf $4}')"
QUD_EXTERNAL_VERSION="$(qpm-cli --info qud 2>/dev/null | grep "Installed" | awk '{printf $4}')"
QUD_SLT_VERSION="$(qpm-cli --info qud.slt 2>/dev/null | grep "Installed" | awk '{printf $4}')"

if [ -n "$QUD_INTERNAL_VERSION" ] || [ -n "$QUD_EXTERNAL_VERSION" ] || [ -n "$QUD_SLT_VERSION" ]; then
if [ -n "$QUD_INTERNAL_VERSION" ]; then
echo "[QUD_Userspace] Uninstalling qud.internal ($QUD_INTERNAL_VERSION) via qpm-cli..." >> "$LOG_FILE" 2>&1
qpm-cli --uninstall qud.internal --silent --force >> "$LOG_FILE" 2>&1 || true
QUD_INTERNAL_VERSION="\$(qpm-cli --info qud.internal 2>/dev/null | grep "Installed" | awk '{printf \$4}')"
QUD_EXTERNAL_VERSION="\$(qpm-cli --info qud 2>/dev/null | grep "Installed" | awk '{printf \$4}')"
QUD_SLT_VERSION="\$(qpm-cli --info qud.slt 2>/dev/null | grep "Installed" | awk '{printf \$4}')"

if [ -n "\$QUD_INTERNAL_VERSION" ] || [ -n "\$QUD_EXTERNAL_VERSION" ] || [ -n "\$QUD_SLT_VERSION" ]; then
if [ -n "\$QUD_INTERNAL_VERSION" ]; then
echo "[QUD_Userspace] Uninstalling qud.internal (\$QUD_INTERNAL_VERSION) via qpm-cli..." >> "\$LOG_FILE" 2>&1
qpm-cli --uninstall qud.internal --silent --force >> "\$LOG_FILE" 2>&1 || true
fi
if [ -n "$QUD_EXTERNAL_VERSION" ]; then
echo "[QUD_Userspace] Uninstalling qud ($QUD_EXTERNAL_VERSION) via qpm-cli..." >> "$LOG_FILE" 2>&1
qpm-cli --uninstall qud --silent --force >> "$LOG_FILE" 2>&1 || true
if [ -n "\$QUD_EXTERNAL_VERSION" ]; then
echo "[QUD_Userspace] Uninstalling qud (\$QUD_EXTERNAL_VERSION) via qpm-cli..." >> "\$LOG_FILE" 2>&1
qpm-cli --uninstall qud --silent --force >> "\$LOG_FILE" 2>&1 || true
fi
if [ -n "$QUD_SLT_VERSION" ]; then
echo "[QUD_Userspace] Uninstalling qud.slt ($QUD_SLT_VERSION) via qpm-cli..." >> "$LOG_FILE" 2>&1
qpm-cli --uninstall qud.slt --silent --force >> "$LOG_FILE" 2>&1 || true
if [ -n "\$QUD_SLT_VERSION" ]; then
echo "[QUD_Userspace] Uninstalling qud.slt (\$QUD_SLT_VERSION) via qpm-cli..." >> "\$LOG_FILE" 2>&1
qpm-cli --uninstall qud.slt --silent --force >> "\$LOG_FILE" 2>&1 || true
fi
else
echo "[QUD_Userspace] The User hasn't installed QUD driver via qpm-cli" >> "$LOG_FILE" 2>&1
echo "[QUD_Userspace] No qpm-cli QUD packages installed, skipping." >> "\$LOG_FILE" 2>&1
fi
else
echo "[QUD_Userspace] qpm-cli not available, skipping qpm-cli QUD uninstall." >> "$LOG_FILE" 2>&1
echo "[QUD_Userspace] qpm-cli not available, skipping qpm-cli QUD uninstall." >> "\$LOG_FILE" 2>&1
fi

echo "[QUD_Userspace] Executing qcom_userspace.sh to enable userspace driver..." >> "$LOG_FILE" 2>&1
if [ -x "$INSTALL_PREFIX/qcom_userspace.sh" ]; then
cd "$INSTALL_PREFIX" || true
"$INSTALL_PREFIX/qcom_userspace.sh" install >> "$LOG_FILE" 2>&1 || echo "[QUD_Userspace] WARNING: qcom_userspace.sh returned non-zero exit." >> "$LOG_FILE" 2>&1
mkdir -p "\$INSTALL_PREFIX" || true

# Move the preinst temp log into INSTALL_PREFIX so postinst appends there
FINAL_LOG="\$INSTALL_PREFIX/qcom_userspace_install.log"
mv "\$LOG_FILE" "\$FINAL_LOG" || true
chmod 0644 "\$FINAL_LOG" || true

exit 0
EOF
chmod 0755 "$BUILDROOT/DEBIAN/preinst"

# Create DEBIAN/postinst
cat > "$BUILDROOT/DEBIAN/postinst" <<EOF
#!/usr/bin/env bash
set -e

INSTALL_PREFIX="$INSTALL_PREFIX"
LOG_FILE="\$INSTALL_PREFIX/qcom_userspace_install.log"

$QUD_COMMON_FUNCS

echo "[QUD_Userspace] Ensuring script permissions..." >> "\$LOG_FILE" 2>&1
chmod 0755 "\$INSTALL_PREFIX/qcom_userspace.sh" \\
"\$INSTALL_PREFIX/qcom_drivers.sh" \\
"\$INSTALL_PREFIX/QcDevDriver.sh" || true

# Install userspace driver
LOG_HEADER "Executing qcom_userspace.sh install"
echo "[QUD_Userspace] Executing qcom_userspace.sh to enable userspace driver..." >> "\$LOG_FILE" 2>&1
if [ -x "\$INSTALL_PREFIX/qcom_userspace.sh" ]; then
cd "\$INSTALL_PREFIX" || true
"\$INSTALL_PREFIX/qcom_userspace.sh" install >> "\$LOG_FILE" 2>&1 \\
|| echo "[QUD_Userspace] WARNING: qcom_userspace.sh returned non-zero exit." >> "\$LOG_FILE" 2>&1
else
echo "[QUD_Userspace] ERROR: $INSTALL_PREFIX/qcom_userspace.sh install not found." >> "$LOG_FILE" 2>&1
echo "[QUD_Userspace] ERROR: \$INSTALL_PREFIX/qcom_userspace.sh install not found." >> "\$LOG_FILE" 2>&1
fi

exit 0
Expand Down Expand Up @@ -313,4 +322,4 @@ if [ "$OPTION_ZIP" == "zip" ]; then
cp ./build/ReleaseNotes.txt "${ZIP_FOLDER}/"
zip -r "${ZIP_FOLDER}.zip" "${ZIP_FOLDER}"
rm -rf "${ZIP_FOLDER}"
fi
fi
Loading