CFUMASS(4)

πŸ’– CFUMASS(4) πŸ’–

okay so bestie, this is the Kernel Interfaces Manual page for cfumass β€” USB device side support for Mass Storage Class Transport. and yes we're doing this whole thing, every flag, every default, no skips. periodt. ✨


🌸 NAME 🌸

cfumass β€” USB device side support for Mass Storage Class Transport


πŸŽ€ SYNOPSIS πŸŽ€

so you can bake this driver straight into the kernel by dropping these lines into your kernel configuration file:

device usb
device usb_template
device ctl
device cfumass

orrr you can just load the driver module at boot by adding this line to loader.conf(5):

cfumass_load="YES"

either way works, pick your fighter πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

cfumass is the driver that lets your machine pretend to be a USB mass storage device β€” like, you're the USB stick now, bestie. it emulates a device that's compliant with the USB Mass Storage Class Bulk-Only (BBB) Transport specification, and it's implemented as a ctl(4) frontend driver. iconic behaviour honestly.

to actually use cfumass, here's the checklist, no skips:

  • cfumass(4) has to be loaded as a module or compiled into the kernel.
  • the USB Mass Storage template has to be chosen by setting the hw.usb.template sysctl to 0.
  • the USB OTG port has to be working in USB device-side mode. this happens automatically when you connect to a USB host, so don't stress 🫢
  • there has to be a ctl(4) LUN configured for the cfumass port.

when it loads, the driver creates a ctl(4) port named cfumass, and it presents the first LUN mapped for that port β€” usually LUN 0 β€” to the USB host. for the details on configuring the LUN, go look at ctl.conf(5) and ctld(8). and if you want an automated way to configure it at boot, check the cfumass_enable and cfumass_dir rc(8) variables in rc.conf(5). set it and forget it, lowkey the move πŸ’œ


✨ SYSCTL VARIABLES ✨

these variables are available as both sysctl(8) variables and loader(8) tunables. two for the price of one, we love that:

  • hw.usb.cfumass.debug β€” verbosity level for log messages coming from the cfumass driver. set it to 0 to disable logging, or 1 to warn about potential problems. bigger values turn on debugging output. defaults to 1.
  • hw.usb.cfumass.ignore_stop β€” ignore START STOP UNIT SCSI commands that have the START and LOEJ bits cleared. here's the tea: some initiators send that command to stop the target when the user tries to gracefully eject the drive, but then they fail to start it again when the drive gets reconnected 😭 so set it to 0 to handle the command in a standards-compliant way, 1 to ignore it and log a warning, or 2 to ignore it silently. defaults to 1.
  • hw.usb.cfumass.max_lun β€” max LUN number to report to the initiator (that's the USB host). must be between 0 and 15. heads up: some initiators incorrectly handle values larger than 0. defaults to 0.

πŸ‘‘ SEE ALSO πŸ‘‘

ctl(4), umass(4), usb(4), usb_template(4), ctl.conf(5), ctld(8)


🌈 HISTORY 🌈

the cfumass driver first appeared in FreeBSD 11.1. a legend from day one, fr fr ⭐


πŸ’– AUTHORS πŸ’–

the cfumass driver was developed by Edward Tomasz Napierala <trasz@FreeBSD.org> under sponsorship from the FreeBSD Foundation. absolute main character energy 🫢


and that's the whole page, bestie! this one came from the Debian build, dated April 21, 2018, and it lives under the manual name CFUMASS(4). go forth and emulate some mass storage πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from