NG_H4(4)
π NG_H4 π
okay bestie, so <sys/types.h> and <netgraph/bluetooth/include/ng_h4.h> are the vibe, ng_h4 is the name, and it's the Netgraph node type that's also an H4 line discipline. two jobs, one icon. π
β¨ SYNOPSIS β¨
#include <sys/types.h>
#include <netgraph/bluetooth/include/ng_h4.h>
πΈ DESCRIPTION πΈ
So the h4 node type is lowkey doing double duty: it's a persistent Netgraph node type and an H4 line discipline. It implements a Bluetooth HCI UART transport layer, exactly as chapter H4 of the Bluetooth Specification Book v1.1 says to do it. no improvising, we're following the spec fr fr.
A brand new node gets created when the corresponding line discipline, H4DISC, is registered on a tty device (go look at tty(4) for that part, iykyk).
The node has a single hook called hook. Here's the flow, bestie, follow me:
- Incoming bytes that show up on the tty device get re-assembled into HCI frames (according to the length).
- Full HCI frames get sent out on the
hook. - HCI frames received on
hookget transmitted out on the tty device. - No modification to the data happens in either direction. we do not touch the data. we simply vibe. π
While the line discipline is installed on a tty, the normal read and write operations are unavailable, and they return EIO. so like, don't try it. it's giving blocked.
Info about the node is available via the netgraph ioctl(2) command NGIOCGINFO. That command returns a struct nodeinfo, similar to the NGM_NODEINFO netgraph(4) control message.
πͺ HOOKS πͺ
This node type supports the following hooks:
hookβ single HCI frame contained in single mbuf structure.
π CONTROL MESSAGES π
This node type supports the generic control messages, plus these little cuties:
NGM_H4_NODE_RESETβ Reset the node.NGM_H4_NODE_GET_STATEβ Returns current receiving state for the node.NGM_H4_NODE_GET_DEBUGβ Returns an integer containing the current debug level for the node.NGM_H4_NODE_SET_DEBUGβ This command takes an integer argument and sets current debug level for the node.NGM_H4_NODE_GET_QLENβ Returns current length of outgoing queue for the node.NGM_H4_NODE_SET_QLENβ This command takes an integer argument and sets maximum length of outgoing queue for the node.NGM_H4_NODE_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.NGM_H4_NODE_RESET_STATβ Reset all statistic counters to zero.
π SHUTDOWN π
This node shuts down when the corresponding device is closed (or the line discipline is uninstalled on the device). that's it, that's the goodbye. π¦
π SEE ALSO π
ioctl(2), netgraph(4), tty(4), ngctl(8)
π HISTORY π
The h4 node type was implemented in FreeBSD 5.0. an OG, periodt.
π«Ά AUTHORS π«Ά
Maksim Yevmenkin <m_evmenkin@yahoo.com>
π BUGS π
This node still uses spltty(9) to lock tty layer. This is wrong.
not me reading this and going π β it's literally in the manual, bestie. it's wrong and they know it.
and that's the whole page, mwah π this one came out of the Debian crew, dated June 14, 2002 β so like, a whole legend before most of us could even type. stay hydrated, read your manpages, ily. πβ¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms