Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Functions
u_serial.h File Reference
#include <linux/usb/composite.h>
#include <linux/usb/cdc.h>

Go to the source code of this file.

Data Structures

struct  gserial
 

Functions

struct usb_requestgs_alloc_req (struct usb_ep *ep, unsigned len, gfp_t flags)
 
void gs_free_req (struct usb_ep *, struct usb_request *req)
 
int gserial_setup (struct usb_gadget *g, unsigned n_ports)
 
void gserial_cleanup (void)
 
int gserial_connect (struct gserial *, u8 port_num)
 
void gserial_disconnect (struct gserial *)
 
int acm_bind_config (struct usb_configuration *c, u8 port_num)
 
int gser_bind_config (struct usb_configuration *c, u8 port_num)
 
int obex_bind_config (struct usb_configuration *c, u8 port_num)
 

Function Documentation

int acm_bind_config ( struct usb_configuration c,
u8  port_num 
)

acm_bind_config - add a CDC ACM function to a configuration : the configuration to support the CDC ACM instance : /dev/ttyGS* port this interface will use Context: single threaded during gadget setup

Returns zero on success, else negative errno.

Caller must have called () with enough ports to handle all the ones it binds. Caller is also responsible for calling () before module unload.

Definition at line 752 of file f_acm.c.

struct usb_request* gs_alloc_req ( struct usb_ep ep,
unsigned  len,
gfp_t  flags 
)
read

Definition at line 291 of file u_serial.c.

void gs_free_req ( struct usb_ep ,
struct usb_request req 
)

Definition at line 314 of file u_serial.c.

int gser_bind_config ( struct usb_configuration c,
u8  port_num 
)

gser_bind_config - add a generic serial function to a configuration : the configuration to support the serial instance : /dev/ttyGS* port this interface will use Context: single threaded during gadget setup

Returns zero on success, else negative errno.

Caller must have called () with enough ports to handle all the ones it binds. Caller is also responsible for calling () before module unload.

Definition at line 286 of file f_serial.c.

void gserial_cleanup ( void  )

gserial_cleanup - remove TTY-over-USB driver and devices Context: may sleep

This is called to free all resources allocated by (). Accordingly, it may need to wait until some open /dev/ files have closed.

The caller must have issued () for any ports that had previously been connected, so that there is never any I/O pending when it's called.

Definition at line 1172 of file u_serial.c.

int gserial_connect ( struct gserial gser,
u8  port_num 
)

gserial_connect - notify TTY I/O glue that USB link is active : the function, set up with endpoints and descriptors : which port is active Context: any (usually from irq)

This is called activate endpoints and let the TTY layer know that the connection is active ... not unlike "carrier detect". It won't necessarily start I/O queues; unless the TTY is held open by any task, there would be no point. However, the endpoints will be activated so the USB host can perform I/O, subject to basic USB hardware flow control.

Caller needs to have set up the endpoints and USB function in before calling this, as well as the appropriate (speed-specific) endpoint descriptors, and also have set up the TTY driver by calling ().

Returns negative errno or zero. On success, ep->driver_data will be overwritten.

Definition at line 1230 of file u_serial.c.

void gserial_disconnect ( struct gserial gser)

gserial_disconnect - notify TTY I/O glue that USB link is inactive : the function, on which gserial_connect() was called Context: any (usually from irq)

This is called to deactivate endpoints and let the TTY layer know that the connection went inactive ... not unlike "hangup".

On return, the state is as if gserial_connect() had never been called; there is no active USB I/O on these endpoints.

Definition at line 1299 of file u_serial.c.

int gserial_setup ( struct usb_gadget g,
unsigned  count 
)

gserial_setup - initialize TTY driver for one or more ports : gadget to associate with these ports : how many ports to support Context: may sleep

The TTY stack needs to know in advance how many devices it should plan to manage. Use this call to set up the ports you will be exporting through USB. Later, connect them to functions based on what configuration is activated by the USB host; and disconnect them as appropriate.

An example would be a two-configuration device in which both configurations expose port 0, but through different functions. One configuration could even expose port 1 while the other one doesn't.

Returns negative errno or zero.

Definition at line 1071 of file u_serial.c.

int obex_bind_config ( struct usb_configuration c,
u8  port_num 
)

obex_bind_config - add a CDC OBEX function to a configuration : the configuration to support the CDC OBEX instance : /dev/ttyGS* port this interface will use Context: single threaded during gadget setup

Returns zero on success, else negative errno.

Caller must have called () with enough ports to handle all the ones it binds. Caller is also responsible for calling () before module unload.

Definition at line 418 of file f_obex.c.