USB-C Daemon (Developed with the assistance of Github Co-pilot)
usbcd is a USB-C daemon that monitors USB device events and provides notifications for various USB-C scenarios including billboard enumeration, charger notifications, and bandwidth management.
This project requires the following libraries and development tools:
- Ubuntu 24.04 LTS or compatible Linux distribution
- CMake 3.0.0 or higher
- GCC compiler
- pkg-config
- libudev (USB device monitoring)
- glib-2.0 (GLib utilities and data structures)
- libnotify (Desktop notifications)
sudo apt update
sudo apt upgrade -ysudo apt install -y build-essential cmake pkg-config gitsudo apt install -y \
libudev-dev \
libglib2.0-dev \
libnotify-devCheck that all required packages are installed:
pkg-config --exists libudev && echo "libudev: OK" || echo "libudev: MISSING"
pkg-config --exists glib-2.0 && echo "glib-2.0: OK" || echo "glib-2.0: MISSING"
pkg-config --exists libnotify && echo "libnotify: OK" || echo "libnotify: MISSING"git clone <repository-url>
cd usbcdmkdir -p build
cd buildcmake ..makeAlternatively, you can build with multiple cores for faster compilation:
make -j$(nproc)If you prefer to build directly in the source directory:
cmake .
make./usbcdThe daemon uses the usbcd.conf configuration file for settings. Make sure this file is in the same directory as the executable or modify the path in the source code as needed.
You can control the logging verbosity by editing the usbcd.conf file:
[general]
LogLevel = infoSupported log levels:
debug- Detailed debugging informationinfo- General information messages (default)warning- Warning messages only
To run usbcd as a systemd service that starts automatically on boot:
sudo cp usbcd.service /etc/systemd/system/usbcd.serviceAlternatively, you can create the file manually:
sudo nano /etc/systemd/system/usbcd.serviceThen copy the content from the usbcd.service file provided in this repository.
sudo cp usbcd /usr/local/bin/
sudo chmod +x /usr/local/bin/usbcdsudo cp usbcd.conf /etc/usbcd.confImportant: The systemd service is configured to run from /etc directory to find the configuration file. Make sure usbcd.conf is placed in /etc/usbcd.conf for the service to work properly.
# Reload systemd to recognize the new service
sudo systemctl daemon-reload
# Enable the service to start on boot
sudo systemctl enable usbcd.service
# Start the service immediately
sudo systemctl start usbcd.service# Check service status
sudo systemctl status usbcd.service
# View service logs
sudo journalctl -u usbcd.service -f# Stop the service
sudo systemctl stop usbcd.service
# Restart the service
sudo systemctl restart usbcd.service
# Disable automatic startup
sudo systemctl disable usbcd.service
# Check if service is enabled
sudo systemctl is-enabled usbcd.serviceTo run the daemon manually in the background:
./usbcd &To stop a background process:
# Find the process ID
ps aux | grep usbcd
# Kill the process (replace XXXX with actual PID)
kill XXXX- USB Device Monitoring: Monitors USB device insertion/removal events
- Billboard Device Support: Handles USB-C billboard device enumeration
- Desktop Notifications: Provides user notifications for USB-C events
- Charger Detection: Notifies users about charger connection status
- Bandwidth Management: Monitors and reports USB-C bandwidth usage
- USB-C Alternate Modes Display: Planned enhancements to show detailed alternate mode information (contributions welcome!)
- Enhanced Mode Detection: Better detection and display of DisplayPort, Thunderbolt, HDMI, and other alternate modes
- Improved User Interface: More intuitive notifications and status reporting
If you encounter permission issues when monitoring USB devices, you may need to run with appropriate privileges:
sudo ./usbcdIf you get compilation errors about missing headers, ensure all development packages are installed:
sudo apt install -y libudev-dev libglib2.0-dev libnotify-devIf CMake version is too old:
sudo apt install -y cmake
# Or install a newer version from Kitware's repository if neededTo clean and rebuild:
make clean
makeFor debug builds with additional symbols:
cmake -DCMAKE_BUILD_TYPE=Debug ..
makeMIT License - See LICENSE file for details.
- Saranya Gopal saranya.gopal@intel.com
- Rajaram Regupathy rajaram.regupathy@intel.com
Developed with the assistance of Github Copilot.
We welcome and encourage contributions to the usbcd project! This is an open-source initiative aimed at improving USB-C device management and user experience on Linux systems.
We are particularly interested in contributions in the following areas:
- USB-C Alternate Modes Display: Enhancing the user interface to display detailed information about USB-C alternate modes (DisplayPort, Thunderbolt, HDMI, etc.)
- Mode Detection and Reporting: Improving detection and reporting of various USB-C modes and capabilities
- User Interface Improvements: Better notification systems and user feedback mechanisms
- Cross-Platform Support: Extending support to other Linux distributions
- Documentation: Improving installation guides, troubleshooting, and usage documentation
- Testing: Adding unit tests, integration tests, and platform compatibility testing
- Fork the repository and create a feature branch
- Follow the existing code style and add appropriate logging
- Test your changes thoroughly on different systems
- Add documentation for new features
- Submit a pull request with a clear description of your changes
All contributions should include proper Signed-off-by tags as shown in the commit history.