Skip to content
Closed
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
59 changes: 53 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ The project is organized to facilitate easy compilation, testing, and integratio

```
/
├─ debian/ # Debian packaging files for .deb package build
├─ docs/ # Architecture diagrams and design documents
├─ src/ # Qualcomm USB kernel driver for windows and linux platform
├─ examples/ # samples scripts
├─ examples/ # Sample scripts
├─ build-deb.sh # Build script for generating the .deb package
├─ dkms.conf # DKMS configuration for kernel module management
├─ README.md # This file
└─ ... # Other files and directories
```
Expand All @@ -33,6 +36,7 @@ The project is organized to facilitate easy compilation, testing, and integratio

- GNU Make, GCC/Clang.
- Kernel headers for the target kernel version (`linux-headers-$(uname -r)`).
- For deb package build: `debhelper`, `dkms`, `dpkg-dev`, `dh-dkms`.

### Build Steps

Expand Down Expand Up @@ -86,9 +90,51 @@ pnputil /add-driver <build_path/driver_name.inf> /install
```bash
pnputil /delete-driver oemxx.inf /uninstall /force
```
#### Linux command:
Navigate to folder `src/linux`


#### Linux — Debian Package (Recommended)

The recommended way to install on Debian/Ubuntu systems is via the `.deb` package, which uses DKMS to automatically build kernel modules for the running kernel and handles install, uninstall, upgrade, and version control.

- Build the package
```bash
# Install build dependencies (one-time)
sudo apt-get install debhelper dkms dpkg-dev dh-dkms

# Build
./build-deb.sh
```

- Installation
```bash
sudo dpkg -i ../qcom-usb-drivers-dkms_<version>_all.deb
```

- Uninstallation
```bash
sudo dpkg -r qcom-usb-drivers-dkms
```

- Check installed version
```bash
dpkg -s qcom-usb-drivers-dkms | grep Version
dkms status
```

- Upgrade

Simply install a newer `.deb` — it automatically removes the old version and installs the new one.

**What the deb package does:**
- Builds all 4 kernel modules (`qtiDevInf`, `qcom_usb`, `qcom_usbnet`, `qcom-serial`) via DKMS
- Automatically rebuilds modules when the kernel is updated
- Installs udev rules and blacklists conflicting in-tree modules
- Handles cleanup of pre-existing manual installs
- Loads modules immediately after installation

#### Linux — Manual Install (Alternative)

Navigate to folder `src/linux`

- Installation
```bash
sudo ./qcom_drivers.sh install
Expand All @@ -97,7 +143,8 @@ sudo ./qcom_drivers.sh install
```bash
sudo ./qcom_drivers.sh uninstall
```
For more guidance on build process, FAQ's and troubleshooting, please refer to [README](./src/linux/README.md) document.

For more guidance on build process, FAQ's and troubleshooting, please refer to [README](./src/linux/README.md) document.

## Contributing

Expand All @@ -119,4 +166,4 @@ and conditions before contributing.

## Contact

For questions, bug reports, or feature requests, please open an issue on GitHub or contact the maintainers
For questions, bug reports, or feature requests, please open an issue on GitHub or contact the maintainers
65 changes: 65 additions & 0 deletions build-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/bin/bash
# Build script for qcom-usb-drivers-dkms debian package
# Usage: ./build-deb.sh
#
# Prerequisites: sudo apt-get install debhelper dkms dpkg-dev dh-dkms
set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"

PKG_VERSION=$(grep '#define DRIVER_VERSION' src/linux/version.h | awk '{print $3}' | tr -d '"')
echo "Building qcom-usb-drivers-dkms version $PKG_VERSION"

# Update version in dkms.conf if needed
sed -i "s/^PACKAGE_VERSION=.*/PACKAGE_VERSION=\"${PKG_VERSION}\"/" dkms.conf

# Update version in debian/changelog if needed
CHANGELOG_VER=$(head -1 debian/changelog | grep -oP '\(\K[^)]+')
if [ "$CHANGELOG_VER" != "$PKG_VERSION" ]; then
sed -i "1s/([^)]*)/($PKG_VERSION)/" debian/changelog
fi

# Update version in postinst and preinst if needed
sed -i "s/^PKG_VERSION=.*/PKG_VERSION=\"${PKG_VERSION}\"/" debian/qcom-usb-drivers-dkms.postinst
sed -i "s/^PKG_VERSION=.*/PKG_VERSION=\"${PKG_VERSION}\"/" debian/qcom-usb-drivers-dkms.preinst

# Update version in debian/rules if needed
sed -i "s/^PKG_VERSION := .*/PKG_VERSION := ${PKG_VERSION}/" debian/rules

# Check for required build tools
for tool in dpkg-buildpackage debhelper dkms; do
if [ "$tool" = "debhelper" ]; then
dpkg -l debhelper >/dev/null 2>&1 || { echo "Error: $tool not installed. Run: sudo apt-get install $tool"; exit 1; }
elif [ "$tool" = "dkms" ]; then
dpkg -l dkms >/dev/null 2>&1 || { echo "Error: $tool not installed. Run: sudo apt-get install $tool"; exit 1; }
else
command -v $tool >/dev/null 2>&1 || { echo "Error: $tool not found. Run: sudo apt-get install dpkg-dev"; exit 1; }
fi
done

# Check for dh-dkms (provides dh_dkms helper)
dpkg -l dh-dkms >/dev/null 2>&1 || { echo "Error: dh-dkms not installed. Run: sudo apt-get install dh-dkms"; exit 1; }

# Ensure debian/rules is executable
chmod +x debian/rules

# Clean previous build artifacts
rm -f ../qcom-usb-drivers-dkms_*.deb
rm -f ../qcom-usb-drivers-dkms_*.buildinfo
rm -f ../qcom-usb-drivers-dkms_*.changes
rm -rf debian/qcom-usb-drivers-dkms
rm -rf debian/.debhelper

# Build the package (unsigned)
dpkg-buildpackage -us -uc -b

echo ""
echo "========================================"
echo "Build complete! Package files:"
ls -la ../qcom-usb-drivers-dkms_${PKG_VERSION}*.deb 2>/dev/null || echo "(deb file in parent directory)"
echo ""
echo "Install with: sudo dpkg -i ../qcom-usb-drivers-dkms_${PKG_VERSION}_all.deb"
echo "Uninstall with: sudo dpkg -r qcom-usb-drivers-dkms"
echo "Check status: dpkg -s qcom-usb-drivers-dkms"
echo "========================================"
7 changes: 7 additions & 0 deletions debian/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Build artifacts generated by dpkg-buildpackage
.debhelper/
debhelper-build-stamp
files
*.substvars
*.debhelper
qcom-usb-drivers-dkms/
10 changes: 10 additions & 0 deletions debian/60-qcom-usb-drivers.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Qualcomm USB device udev rules
# GobiNet network device
SUBSYSTEM=="net", DRIVERS=="GobiNet", MODE="0660", GROUP="plugdev"

# GobiSerial serial ports
SUBSYSTEM=="tty", DRIVERS=="GobiSerial", MODE="0660", GROUP="dialout"

# QDSS diagnostic devices
SUBSYSTEM=="usb", DRIVERS=="QdssDiag", MODE="0660", GROUP="plugdev"
SUBSYSTEM=="usb", DRIVERS=="QdssMdm", MODE="0660", GROUP="plugdev"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QdssMdm is not a driver.
Gobiserial is not in used. User can build it for internal use-case. we are not building it via QcDevDriver.sh script.
and currently we are not using QcDevDriver.sh script as well.

8 changes: 8 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
qcom-usb-drivers-dkms (1.0.6.1) unstable; urgency=medium

* Initial DKMS debian package for Qualcomm USB kernel drivers
* Includes qtiDevInf, qcom_usb, qcom_usbnet, qcom-serial modules
* Blacklists conflicting in-tree modules (qcserial, qmi_wwan, option, usb_wwan)
* Installs udev rules for Qualcomm USB device permissions

-- Qualcomm Technologies, Inc. <qcom-usb-drivers@qualcomm.com> Tue, 08 Apr 2025 10:00:00 -0700
23 changes: 23 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Source: qcom-usb-drivers-dkms
Section: kernel
Priority: optional
Maintainer: Qualcomm Technologies, Inc. <qcom-usb-drivers@qualcomm.com>
Build-Depends: debhelper-compat (= 13), dkms
Standards-Version: 4.6.0
Rules-Requires-Root: no

Package: qcom-usb-drivers-dkms
Architecture: all
Depends: ${misc:Depends}, dkms, linux-headers-generic | linux-headers-amd64 | linux-headers-arm64
Conflicts: qcom-usb-userspace-driver
Replaces: qcom-usb-userspace-driver
Description: Qualcomm USB kernel drivers (DKMS)
DKMS package for Qualcomm USB kernel drivers including:
* qtiDevInf - INF file parser for device enumeration
* qcom_usb - USB diagnostic and QDSS driver
* qcom_usbnet - USB network (WWAN) adapter driver
* qcom-serial - USB serial/modem port driver
.
These drivers are automatically built for the running kernel using DKMS
and will be rebuilt when the kernel is updated. Conflicting in-tree
modules (qcserial, qmi_wwan, option, usb_wwan) are blacklisted.
23 changes: 23 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: qcom-usb-drivers
Upstream-Contact: Qualcomm Technologies <qcom-usb-drivers@qualcomm.com>

Files: *
Copyright: 2025-2026 Qualcomm Technologies, Inc. and/or its subsidiaries.
License: BSD-3-Clause
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
.
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.
1 change: 1 addition & 0 deletions debian/qcom-usb-drivers-dkms.dkms
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dkms.conf
16 changes: 16 additions & 0 deletions debian/qcom-usb-drivers-dkms.modprobe
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Qualcomm USB kernel drivers - module configuration
# Installed by qcom-usb-drivers-dkms package

# Blacklist conflicting in-tree modules so that Qualcomm drivers are used
blacklist qcserial
install qcserial /bin/false
blacklist qmi_wwan
install qmi_wwan /bin/false
blacklist option
install option /bin/false
blacklist usb_wwan
install usb_wwan /bin/false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do not need modprobe file here. this content is already taken care by our qcom_driver.sh script.

# Load Qualcomm USB drivers at boot (qtiDevInf must load first)
softdep qcom_usb pre: qtiDevInf
softdep qcom_usbnet pre: qtiDevInf
43 changes: 43 additions & 0 deletions debian/qcom-usb-drivers-dkms.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash
# Post-installation script for qcom-usb-drivers-dkms
set -e

PKG_NAME="qcom-usb-drivers"
PKG_VERSION="1.0.6.1"

# DEBHELPER runs dkms add/build/install here
#DEBHELPER#

case "$1" in
configure)
# Reload udev rules
udevadm control --reload-rules 2>/dev/null || true
udevadm trigger 2>/dev/null || true

# Update module dependencies
depmod -a 2>/dev/null || true

# Unload conflicting in-tree modules if loaded
for mod in qcserial qmi_wwan cdc_wdm option usb_wwan; do
if lsmod | grep -qw "$mod"; then
echo " Unloading conflicting module: $mod"
rmmod "$mod" 2>/dev/null || true
fi
done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already handled by the qcom_driver.sh script.

# Load the Qualcomm drivers (order matters: qtiDevInf first)
for mod in qtiDevInf qcom_usb qcom_usbnet qcom-serial; do
modprobe "$mod" 2>/dev/null || true
done

echo "qcom-usb-drivers $PKG_VERSION: modules installed and loaded successfully."
;;

abort-upgrade|abort-remove|abort-deconfigure)
;;

*)
;;
esac

exit 0
Loading