RADIO(4)

πŸ“¦
version 11.0 Β· 2 versions
, in nixpkgs unstable

πŸ’– RADIO(4) β€” the kernel interfaces manual, but make it cute πŸ’–

okay bestie, welcome to RADIO(4), straight out of the Kernel Interfaces Manual ✨ this is the page for the radio driver layer, and no cap, it's actually kind of iconic πŸ’…


🌈 NAME 🌈

radio β€” the device-independent radio driver layer πŸŽ€

like, it's the layer. the vibe layer between you and the hardware. iykyk.


✨ SYNOPSIS ✨

here's how the thing gets attached to the kernel, bestie β€” all these are literally valid:

radio* at az?
radio* at bktr?
radio* at gtp?
radio* at rt?
radio* at rtii?
radio* at sf2r?
radio* at slurm?
radio* at udsbr?

and for your C file, you're gonna include these, exactly these, no substitutions πŸ™ˆ:

#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/radioio.h>

πŸ¦‹ DESCRIPTION πŸ¦‹

so the radio driver is the support system for a whole bunch of FM radio cards 🌸 it gives you one uniform programming interface layer sitting on top of all the different underlying radio hardware drivers β€” like a group chat where everyone's on their best behaviour πŸ’…

for controlling the radio tuner you've got exactly one device file, and it's:

  • /dev/radio

the following ioctl(2) commands are supported, and yes i'm listing every single one πŸ‘‘

  • RIOCSSRCH (int) β€” this command assumes a signal search is needed and tells the driver which direction to go: 0 searches down ⬇️, and any non-zero value searches up ⬆️
  • RIOCGINFO (struct radio_info)
  • RIOCSINFO (struct radio_info) β€” these two get or set the current hardware device information into the struct radio_info structure 🫢

and here's that struct, verbatim, because there's literally no other way to do it:

struct radio_info {
        int     mute;
        int     volume;
        int     stereo;
        int     rfreq;  /* reference frequency */
        int     lock;   /* locking field strength */
        uint32_t        freq;   /* in kHz */
        uint32_t        caps;   /* card capabilities */
#define RADIO_CAPS_DETECT_STEREO        (1<<0)
#define RADIO_CAPS_DETECT_SIGNAL        (1<<1)
#define RADIO_CAPS_SET_MONO             (1<<2)
#define RADIO_CAPS_HW_SEARCH            (1<<3)
#define RADIO_CAPS_HW_AFC               (1<<4)
#define RADIO_CAPS_REFERENCE_FREQ       (1<<5)
#define RADIO_CAPS_LOCK_SENSITIVITY     (1<<6)
#define RADIO_CARD_TYPE                 (0xFF<<16)
        uint32_t        info;
#define RADIO_INFO_STEREO               (1<<0)
#define RADIO_INFO_SIGNAL               (1<<1)
};

okay now field-by-field, because you deserve the tea β˜•:

  • the mute field is a boolean βœ…
  • the volume field holds the card volume information, and it can be at most 255 πŸ”‰
  • the stereo field is a boolean βœ…
  • the rfreq field holds information about the card reference frequency β€” and btw not all cards support this feature πŸ™ˆ
  • the lock field holds information about the card locking field strength during an automatic search, for the cards that support this feature πŸ”’
  • the freq field is the frequency in kHz that the card is tuned to πŸ“»
  • the caps field is read-only and describes the card's capabilities πŸ’…

the capabilities can have the following values β€” these are the ✨main character✨ constants:

  • RADIO_CAPS_DETECT_STEREO β€” the device can determine whether it's tuned to a stereo signal
  • RADIO_CAPS_DETECT_SIGNAL β€” the device can determine whether it's tuned or not
  • RADIO_CAPS_SET_MONO β€” the device is capable of forcibly setting its output to mono
  • RADIO_CAPS_HW_SEARCH β€” the device can do a hardware search
  • RADIO_CAPS_HW_AFC β€” the device has an internal hardware automatic frequency control
  • RADIO_CAPS_REFERENCE_FREQ β€” the device allows you to change the reference frequency of a received signal
  • RADIO_CAPS_LOCK_SENSITIVITY β€” the device allows you to change the station lock sensitivity used during the search operation
  • RADIO_CARD_TYPE β€” some cards have several different incarnations, so this lets you determine the variant of the card. it's currently not used πŸ’€

the info field is read-only and describes the current state of the card β€” tuned/not tuned, stereo signal/mono signal πŸŽ€

  • RADIO_INFO_STEREO β€” informs whether the device receives a stereo or a mono signal
  • RADIO_INFO_SIGNAL β€” informs whether the device receives a valid signal or noise πŸ“Ά

πŸŽ€ FILES πŸŽ€

  • /dev/radio

🌸 SEE ALSO 🌸

radioctl(1), ioctl(2), az(4), bktr(4), gtp(4), rt(4), rtii(4), sf2r(4), slurm(4), udsbr(4)

go read your friends too, bestie, they're all linked 🫢


⭐ HISTORY ⭐

the radio device driver appeared in OpenBSD 3.0 and NetBSD 1.6 🧚 lowkey a legacy icon, honestly.


πŸ‘‘ AUTHORS πŸ‘‘

the radio driver was written by Vladimir Popov and Maxim Tsyplakov for OpenBSD, and ported to NetBSD by Lennart Augustsson πŸ’œ and the man page itself was written by Vladimir Popov ✍️


ok so real talk β€” all the capability and info bits live inside struct radio_info and a bunch of them are read-only, so don't come for caps or info expecting to write to them, they will not be taking that energy 😭 and RADIO_CARD_TYPE is literally unused right now, so like… it's giving placeholder. periodt. πŸ’€

and that's the whole page, bestie 🌈 this was RADIO(4) from the Debian build of the manual, dated October 20, 2001 β€” hope you slayed your tuning πŸ’…βœ¨

πŸ“¦ where this page comes from