USB4 HI Linux Driver
===================

This is the Linux USB4 HI Driver that handles interrupts and read/write operations to and from the USB4CV application.


Version Information
===================

To get the version of the driver, either check the top of usb4-hi-core.c for the version string or run "modinfo usb4_hi" after installing the driver. 


Installation instructions
=========================

This driver will compile as a single module called "usb4_hi.ko".

The following steps were tested on Ubuntu 24.04.1 with kernel version 6.8.0-53-generic.

To compile, you can usually run "sudo ./compileDriverUbuntu.sh" and it will install dependencies and compile the driver automatically.

You should see new device files in /dev/usb4_hi* for each USB4 host controller connected.
You can also see a message in the kernel log noting the total amount of paths available.

$ sudo dmesg | tail
[ 2806.089833] usb4_hi 0000:03:00.0: 12 paths supported
[ 2806.089929] usb4_hi 0000:03:00.0: driver initialized

Loading the Driver
===================

Note: The driver swap might make the keyboard/mouse unusable.

To load the usb4_hi driver, unload the standard Thunderbolt driver and load the usb4_hi driver:

sudo modprobe -r thunderbolt
sudo modprobe usb4_hi


Manual Steps (Optional)
=======================

If you do not want to use the script, here are the manual steps for Ubuntu:

1. Install build tools (make and GCC) and kernel headers for booted kernel (example for Ubuntu)
	* sudo apt install build-essential linux-headers-$(uname -r)
2. Symbolic link System.map (symbol table file) to the kernel modules folder
	* sudo ln -s /boot/System.map-$(uname -r) /lib/modules/$(uname -r)/build/System.map
3. Compile driver module
	* cd usb4_hi
	* make
4. Install kernel module
	* sudo make install
5. Blacklist usb4_hi driver so it does not autoload and conflict with standard Linux Thunderbolt driver
    * sudo cp usb4_hi.conf /etc/modprobe.d/
6. Update initramfs so driver blacklist changes get applied.
    * sudo update-initramfs -u -k $(uname -r)

