NG_UBT(4)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’™ NG_UBT β€” the Netgraph node type that's ALSO a Bluetooth USB driver πŸ’™

okay bestie, sit down, because this one is a double threat. We're talking ng_ubt β€” the ubt node type from the Kernel Interfaces Manual. It's giving main character energy in two whole departments at once, and honestly? obsessed. πŸ¦‹


🌸 SYNOPSIS 🌸

like, just include these and you're so good:

#include <sys/types.h>
#include <netgraph/bluetooth/include/ng_ubt.h>

✨ DESCRIPTION ✨

So the ubt node type is both a persistent Netgraph node type and a driver for Bluetooth USB devices. Two jobs, zero complaints, periodt. πŸ’…

It implements a Bluetooth USB transport layer exactly as per chapter H2 of the Bluetooth Specification Book v1.1. And the cute part? A new node just appears β€” poof ✨ β€” when a supported USB device is plugged in. No ceremony, no setup, it just shows up like your bestie at your door with snacks.

The node has a single hook called hook. Here's the vibe:

  • Incoming bytes that arrive on the device get re-assembled into HCI frames (according to the length). little puzzle pieces fitting together, we love to see it 🧩
  • Full HCI frames get sent out on the hook.
  • The node will add an HCI frame indicator if the device didn't send it.
  • HCI frames received on hook get transmitted out.
  • The node will drop the HCI frame indicator unless the device actually requires it to be present.

so basically the node is doing the emotional labour of translating for both sides. icon behaviour, ngl. 🫢


πŸ”₯ HARDWARE πŸ”₯

The ng_ubt driver supports all Bluetooth USB devices that conform with the Bluetooth specification v1.1, including:

  • 3Com 3CREB96
  • AIPTEK BR0R02
  • EPoX BT-DG02
  • Mitsumi Bluetooth USB adapter
  • MSI MS-6967
  • TDK Bluetooth USB adapter
  • Broadcom Bluetooth USB adapter

that's the whole crew right there ⭐


πŸŽ€ HOOKS πŸŽ€

This node type supports the following hooks:

  • hook β€” single HCI frame contained in a single mbuf structure.

one hook. one job. it's giving minimalism and honestly it's working for her πŸ’œ


πŸ‘‘ CONTROL MESSAGES πŸ‘‘

This node type supports the generic control messages, plus the following:

  • NGM_UBT_NODE_GET_DEBUG (get_debug) β€” Returns an integer containing the current debug level for the node.
  • NGM_UBT_NODE_SET_DEBUG (set_debug) β€” This command takes an integer argument and sets the current debug level for the node.
  • NGM_UBT_NODE_GET_QLEN (get_qlen) β€” This command takes a parameter that specifies the queue number and returns the current maximal length of the queue for the node.
  • NGM_UBT_NODE_SET_QLEN (set_qlen) β€” This command takes two parameters that specify the queue number and the maximum length of the queue and sets the maximal length of the queue for the node.
  • NGM_UBT_NODE_GET_STAT (get_stat) β€” Returns various statistic information for the node, such as: number of bytes (frames) sent, number of bytes (frames) received and number of input (output) errors. numbers!! we love numbers!! πŸ“Š
  • NGM_UBT_NODE_RESET_STAT (reset_stat) β€” Reset all statistic counters to zero. fresh start, clean slate, new era 🧚

πŸ’€ SHUTDOWN πŸ’€

This node shuts down when the corresponding USB device is un-plugged. that's it. that's the whole rule. when the device leaves, the node leaves too. devastating but fair 😭


🌈 SEE ALSO 🌈

netgraph(4), ugen(4), usb(4), ngctl(8)

go read those next, iykyk πŸ“š


⭐ HISTORY ⭐

The ubt node type was implemented in FreeBSD 5.0. a classic. an OG. we stan a legacy icon πŸŽ€


πŸ’– AUTHORS πŸ’–

Maksim Yevmenkin <m_evmenkin@yahoo.com>

shoutout to Maksim, absolute legend, no cap 🫑


⚠️ BUGS ⚠️

okay bestie, listen carefully because this part is real:

Isochronous USB transfers are broken. This means that the USB device will not be able to transfer SCO data (voice). like, actual voice. it just won't. not a vibe, but it's the truth 😭

Also: USB interrupt transfers are implemented as bulk-in transfers β€” but that's not really a bug, so don't come for her. πŸ™ˆ


That's the whole page, bestie β€” this one came from the Debian build of the manpage, dated December 26, 2012, and it's NG_UBT(4). go forth and Bluetooth responsibly πŸ’…βœ¨πŸ“

πŸ“¦ where this page comes from