https://github.com/usbbluetooth/usbbluetooth-csharp
UsbBluetooth C# package
https://github.com/usbbluetooth/usbbluetooth-csharp
bluetooth bluetooth-le bluetooth-low-energy csharp security security-tools
Last synced: 6 months ago
JSON representation
UsbBluetooth C# package
- Host: GitHub
- URL: https://github.com/usbbluetooth/usbbluetooth-csharp
- Owner: usbbluetooth
- Created: 2025-10-12T12:51:46.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-11-24T21:09:15.000Z (8 months ago)
- Last Synced: 2025-11-28T08:38:30.549Z (8 months ago)
- Topics: bluetooth, bluetooth-le, bluetooth-low-energy, csharp, security, security-tools
- Language: C#
- Homepage: https://usbbluetooth.github.io
- Size: 41 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# USB Bluetooth
[](https://github.com/usbbluetooth/usbbluetooth-csharp/actions/workflows/build.yml)
[](https://www.nuget.org/packages/UsbBluetooth/)
Take full control of your USB Bluetooth controllers from C#!
For general documentation about the project, please visit [usbbluetooth.github.io](https://usbbluetooth.github.io).
For a C version of this library, check out [UsbBluetooth for C](https://github.com/usbbluetooth/usbbluetooth).
For a Python version of this library, check out [UsbBluetooth for Python](https://github.com/usbbluetooth/usbbluetooth-python) or [Scapy UsbBluetooth](https://github.com/usbbluetooth/scapy-usbbluetooth) for direct integration with Scapy.
## Installation
Use the [NuGet package](https://www.nuget.org/packages/UsbBluetooth/)!
## Usage
Once installed, you may list devices using `UsbBluetoothManager.ListControllersWithDriver()`, and for each device you may `Open()` the device, `Write()` and `Read()` to them and `Close()` it once you are done.
See the [Examples](Examples/) folder for some sample code.
## Plaform quirks
### Windows
In Windows you may have to install WinUSB driver in your device using Zadig. Otherwise, UsbBluetooth will detect your device but it may not be able to take control of your device.
### Linux
Your Linux user must have permissions to access USB hardware. Here are several options to ensure access:
- **Run as root**: Execute the application with elevated privileges using `sudo`. Note that this may not be ideal for security reasons.
- **Add user to a group**: Add your user to the `plugdev`, `usb` or `uucp` group (depending on your distribution). Remeber to reboot or log out and log back in for the changes to take effect. For example:
```
sudo usermod -a -G plugdev $USER
```
- **Create a udev rule**: Create a custom udev rule to automatically set permissions for USB Bluetooth devices. Create a file like `/etc/udev/rules.d/99-usbbluetooth.rules` with content similar to:
```
SUBSYSTEM=="usb", ATTR{idVendor}=="your_vendor_id", ATTR{idProduct}=="your_product_id", MODE="0666"
```
Replace `your_vendor_id` and `your_product_id` with the actual vendor and product IDs of your device (you can find these using `lsusb`). Then reload udev rules with `sudo udevadm control --reload-rules && sudo udevadm trigger`.
## History
Package versions `< 0.1` were bindings around the original C library. The history for those packages can be found in the [usbbluetooth repository](https://github.com/usbbluetooth/usbbluetooth) in the respective tags.
Package versions `>= 0.1` are developed in this repo and based of `LibUsbDotNet`, the C# LibUSB binding.