gserial_connect(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– gserial_connect(9) πŸ’– β€” Kernel API Manual

okay bestie, welcome to the Kernel API Manual page for gserial_connect(9) β€” the little function that tells the TTY I/O glue your USB link is alive and ready to slay ✨

🌸 NAME 🌸

gserial_connect β€” notify the TTY I/O glue that the USB link is active πŸ’…

🌈 SYNOPSIS 🌈

int gserial_connect (struct gserial *gser , u8 port_num );

πŸŽ€ ARGUMENTS πŸŽ€

  • gser β€” the function, already set up with endpoints and descriptors 🫢
  • port_num β€” which port is active πŸ‘‘

πŸ¦‹ CONTEXT πŸ¦‹

any (usually from irq) β€” so yeah, it can run in any context, and usually it's coming from an interrupt 😭

πŸ’œ DESCRIPTION πŸ’œ

Okay so this is the one that activates the endpoints and lets the TTY layer know the connection is active, kind of like β€œcarrier detect” but make it USB ✨. It won't necessarily start the I/O queues; if no task is holding the TTY open, there would be no point anyway. But the endpoints will get activated so the USB host can perform I/O, subject to basic USB hardware flow control πŸŽ€.

Before you call this, caller, you need to have set up the endpoints and the USB function in dev, plus the appropriate (speed-specific) endpoint descriptors. You also need to have allocated port_num by calling gserial_alloc_line 🫢.

It returns a negative errno or zero. On success, ep->driver_data will be overwritten β€” lowkey important, bestie πŸ’….

🌟 SEE ALSO 🌟

Kernel file ./drivers/usb/gadget/function/u_serial.c, plus gs_start_io(9) and gserial_disconnect(9) πŸ¦‹


xoxo πŸ’‹ source/version: ./drivers/usb/gadget/function; date: October 2026 β€” that's the gserial_connect(9) page, bestie! byeee!

πŸ“¦ where this page comes from