FreeBSD kernel usb device Code
uhso.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/eventhandler.h>
#include <sys/sockio.h>
#include <sys/mbuf.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/socket.h>
#include <sys/tty.h>
#include <sys/sysctl.h>
#include <sys/condvar.h>
#include <sys/sx.h>
#include <sys/proc.h>
#include <sys/conf.h>
#include <sys/bus.h>
#include <sys/systm.h>
#include <sys/limits.h>
#include <machine/bus.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/if_types.h>
#include <net/netisr.h>
#include <net/bpf.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
#include <dev/usb/usb_cdc.h>
#include "usbdevs.h"
#include <dev/usb/usb_debug.h>
#include <dev/usb/usb_process.h>
#include <dev/usb/usb_busdma.h>
#include <dev/usb/usb_msctest.h>
#include <dev/usb/serial/usb_serial.h>
Include dependency graph for uhso.c:

Go to the source code of this file.

Data Structures

struct  uhso_tty
 
struct  uhso_softc
 

Macros

#define USB_DEBUG_VAR   uhso_debug
 
#define UHSO_MAX_MTU   2048
 
#define UHSO_IFACE_SPEC(usb_type, port, port_type)    (((usb_type) << 24) | ((port) << 16) | (port_type))
 
#define UHSO_IFACE_USB_TYPE(x)   ((x >> 24) & 0xff)
 
#define UHSO_IFACE_PORT(x)   ((x >> 16) & 0xff)
 
#define UHSO_IFACE_PORT_TYPE(x)   (x & 0xff)
 
#define UHSO_IF_NET   0x01 /* Network packet interface */
 
#define UHSO_IF_MUX   0x02 /* Multiplexed serial port */
 
#define UHSO_IF_BULK   0x04 /* Bulk interface */
 
#define UHSO_PORT_UNKNOWN   0x00
 
#define UHSO_PORT_SERIAL   0x01 /* Serial port */
 
#define UHSO_PORT_NETWORK   0x02 /* Network packet interface */
 
#define UHSO_MPORT_TYPE_CTL   0x00 /* Control port */
 
#define UHSO_MPORT_TYPE_APP   0x01 /* Application */
 
#define UHSO_MPORT_TYPE_PCSC   0x02
 
#define UHSO_MPORT_TYPE_GPS   0x03
 
#define UHSO_MPORT_TYPE_APP2   0x04 /* Secondary application */
 
#define UHSO_MPORT_TYPE_MAX   UHSO_MPORT_TYPE_APP2
 
#define UHSO_MPORT_TYPE_NOMAX   8 /* Max number of mux ports */
 
#define UHSO_PORT_TYPE_UNKNOWN   0x00
 
#define UHSO_PORT_TYPE_CTL   0x01
 
#define UHSO_PORT_TYPE_APP   0x02
 
#define UHSO_PORT_TYPE_APP2   0x03
 
#define UHSO_PORT_TYPE_MODEM   0x04
 
#define UHSO_PORT_TYPE_NETWORK   0x05
 
#define UHSO_PORT_TYPE_DIAG   0x06
 
#define UHSO_PORT_TYPE_DIAG2   0x07
 
#define UHSO_PORT_TYPE_GPS   0x08
 
#define UHSO_PORT_TYPE_GPSCTL   0x09
 
#define UHSO_PORT_TYPE_PCSC   0x0a
 
#define UHSO_PORT_TYPE_MSD   0x0b
 
#define UHSO_PORT_TYPE_VOICE   0x0c
 
#define UHSO_PORT_TYPE_MAX   0x0c
 
#define UHSO_STATIC_IFACE   0x01
 
#define UHSO_AUTO_IFACE   0x02
 
#define UHSO_DEV(v, p, i)   { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) }
 
#define UHSO_DPRINTF(n, x, ...)
 
#define UHSO_HEXDUMP(_buf, _len)
 

Enumerations

enum  { UHSO_MUX_ENDPT_INTR = 0 , UHSO_MUX_ENDPT_MAX }
 
enum  { UHSO_CTRL_READ = 0 , UHSO_CTRL_WRITE , UHSO_CTRL_MAX }
 
enum  { UHSO_IFNET_READ = 0 , UHSO_IFNET_WRITE , UHSO_IFNET_MAX }
 
enum  { UHSO_BULK_ENDPT_READ = 0 , UHSO_BULK_ENDPT_WRITE , UHSO_BULK_ENDPT_INTR , UHSO_BULK_ENDPT_MAX }
 

Functions

 __FBSDID ("$FreeBSD$")
 
static SYSCTL_NODE (_hw_usb, OID_AUTO, uhso, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "USB uhso")
 
 SYSCTL_INT (_hw_usb_uhso, OID_AUTO, auto_switch, CTLFLAG_RWTUN, &uhso_autoswitch, 0, "Automatically switch to modem mode")
 
static int uhso_probe_iface (struct uhso_softc *, int, int(*probe)(struct usb_device *, int))
 
static int uhso_probe_iface_auto (struct usb_device *, int)
 
static int uhso_probe_iface_static (struct usb_device *, int)
 
static int uhso_attach_muxserial (struct uhso_softc *, struct usb_interface *, int type)
 
static int uhso_attach_bulkserial (struct uhso_softc *, struct usb_interface *, int type)
 
static int uhso_attach_ifnet (struct uhso_softc *, struct usb_interface *, int type)
 
static void uhso_test_autoinst (void *, struct usb_device *, struct usb_attach_arg *)
 
static int uhso_driver_loaded (struct module *, int, void *)
 
static int uhso_radio_sysctl (SYSCTL_HANDLER_ARGS)
 
static int uhso_radio_ctrl (struct uhso_softc *, int)
 
static void uhso_free (struct ucom_softc *)
 
static void uhso_ucom_start_read (struct ucom_softc *)
 
static void uhso_ucom_stop_read (struct ucom_softc *)
 
static void uhso_ucom_start_write (struct ucom_softc *)
 
static void uhso_ucom_stop_write (struct ucom_softc *)
 
static void uhso_ucom_cfg_get_status (struct ucom_softc *, uint8_t *, uint8_t *)
 
static void uhso_ucom_cfg_set_dtr (struct ucom_softc *, uint8_t)
 
static void uhso_ucom_cfg_set_rts (struct ucom_softc *, uint8_t)
 
static void uhso_if_init (void *)
 
static void uhso_if_start (struct ifnet *)
 
static void uhso_if_stop (struct uhso_softc *)
 
static int uhso_if_ioctl (struct ifnet *, u_long, caddr_t)
 
static int uhso_if_output (struct ifnet *, struct mbuf *, const struct sockaddr *, struct route *)
 
static void uhso_if_rxflush (void *)
 
static void uhso_free_softc (struct uhso_softc *)
 
 DRIVER_MODULE (uhso, uhub, uhso_driver, uhso_devclass, uhso_driver_loaded, 0)
 
 MODULE_DEPEND (uhso, ucom, 1, 1, 1)
 
 MODULE_DEPEND (uhso, usb, 1, 1, 1)
 
 MODULE_VERSION (uhso, 1)
 
 USB_PNP_HOST_INFO (uhso_devs)
 
static int uhso_probe (device_t self)
 
static int uhso_attach (device_t self)
 
static int uhso_detach (device_t self)
 
 UCOM_UNLOAD_DRAIN (uhso)
 
static int uhso_alloc_tty (struct uhso_softc *sc)
 
static void uhso_mux_intr_callback (struct usb_xfer *xfer, usb_error_t error)
 
static void uhso_mux_read_callback (struct usb_xfer *xfer, usb_error_t error)
 
static void uhso_mux_write_callback (struct usb_xfer *xfer, usb_error_t error)
 
static void uhso_bs_read_callback (struct usb_xfer *xfer, usb_error_t error)
 
static void uhso_bs_write_callback (struct usb_xfer *xfer, usb_error_t error)
 
static void uhso_bs_cfg (struct uhso_softc *sc)
 
static void uhso_bs_intr_callback (struct usb_xfer *xfer, usb_error_t error)
 
static void uhso_ifnet_read_callback (struct usb_xfer *xfer, usb_error_t error)
 
static void uhso_ifnet_write_callback (struct usb_xfer *xfer, usb_error_t error)
 

Variables

static eventhandler_tag uhso_etag
 
static char * uhso_port []
 
static unsigned char uhso_port_map []
 
static char uhso_port_map_max = sizeof(uhso_port_map) / sizeof(char)
 
static unsigned char uhso_mux_port_map []
 
static char * uhso_port_type []
 
static char * uhso_port_type_sysctl []
 
static struct unrhdr * uhso_ifnet_unit = NULL
 
static const STRUCT_USB_HOST_ID uhso_devs []
 
static int uhso_autoswitch = 1
 
static usb_callback_t uhso_mux_intr_callback
 
static usb_callback_t uhso_mux_read_callback
 
static usb_callback_t uhso_mux_write_callback
 
static usb_callback_t uhso_bs_read_callback
 
static usb_callback_t uhso_bs_write_callback
 
static usb_callback_t uhso_bs_intr_callback
 
static usb_callback_t uhso_ifnet_read_callback
 
static usb_callback_t uhso_ifnet_write_callback
 
static const struct usb_config uhso_ctrl_config [UHSO_CTRL_MAX]
 
static const struct usb_config uhso_mux_config [UHSO_MUX_ENDPT_MAX]
 
static const struct usb_config uhso_ifnet_config [UHSO_IFNET_MAX]
 
static const struct usb_config uhso_bs_config [UHSO_BULK_ENDPT_MAX]
 
static device_probe_t uhso_probe
 
static device_attach_t uhso_attach
 
static device_detach_t uhso_detach
 
static device_method_t uhso_methods []
 
static driver_t uhso_driver
 
static devclass_t uhso_devclass
 
static struct ucom_callback uhso_ucom_callback
 

Macro Definition Documentation

◆ UHSO_AUTO_IFACE

#define UHSO_AUTO_IFACE   0x02

Definition at line 248 of file uhso.c.

◆ UHSO_DEV

#define UHSO_DEV (   v,
  p,
 
)    { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) }

◆ UHSO_DPRINTF

#define UHSO_DPRINTF (   n,
  x,
  ... 
)

Definition at line 313 of file uhso.c.

◆ UHSO_HEXDUMP

#define UHSO_HEXDUMP (   _buf,
  _len 
)

Definition at line 327 of file uhso.c.

◆ UHSO_IF_BULK

#define UHSO_IF_BULK   0x04 /* Bulk interface */

Definition at line 136 of file uhso.c.

◆ UHSO_IF_MUX

#define UHSO_IF_MUX   0x02 /* Multiplexed serial port */

Definition at line 135 of file uhso.c.

◆ UHSO_IF_NET

#define UHSO_IF_NET   0x01 /* Network packet interface */

Definition at line 134 of file uhso.c.

◆ UHSO_IFACE_PORT

#define UHSO_IFACE_PORT (   x)    ((x >> 16) & 0xff)

Definition at line 128 of file uhso.c.

◆ UHSO_IFACE_PORT_TYPE

#define UHSO_IFACE_PORT_TYPE (   x)    (x & 0xff)

Definition at line 129 of file uhso.c.

◆ UHSO_IFACE_SPEC

#define UHSO_IFACE_SPEC (   usb_type,
  port,
  port_type 
)     (((usb_type) << 24) | ((port) << 16) | (port_type))

Definition at line 124 of file uhso.c.

◆ UHSO_IFACE_USB_TYPE

#define UHSO_IFACE_USB_TYPE (   x)    ((x >> 24) & 0xff)

Definition at line 127 of file uhso.c.

◆ UHSO_MAX_MTU

#define UHSO_MAX_MTU   2048

Definition at line 114 of file uhso.c.

◆ UHSO_MPORT_TYPE_APP

#define UHSO_MPORT_TYPE_APP   0x01 /* Application */

Definition at line 149 of file uhso.c.

◆ UHSO_MPORT_TYPE_APP2

#define UHSO_MPORT_TYPE_APP2   0x04 /* Secondary application */

Definition at line 152 of file uhso.c.

◆ UHSO_MPORT_TYPE_CTL

#define UHSO_MPORT_TYPE_CTL   0x00 /* Control port */

Definition at line 148 of file uhso.c.

◆ UHSO_MPORT_TYPE_GPS

#define UHSO_MPORT_TYPE_GPS   0x03

Definition at line 151 of file uhso.c.

◆ UHSO_MPORT_TYPE_MAX

#define UHSO_MPORT_TYPE_MAX   UHSO_MPORT_TYPE_APP2

Definition at line 153 of file uhso.c.

◆ UHSO_MPORT_TYPE_NOMAX

#define UHSO_MPORT_TYPE_NOMAX   8 /* Max number of mux ports */

Definition at line 154 of file uhso.c.

◆ UHSO_MPORT_TYPE_PCSC

#define UHSO_MPORT_TYPE_PCSC   0x02

Definition at line 150 of file uhso.c.

◆ UHSO_PORT_NETWORK

#define UHSO_PORT_NETWORK   0x02 /* Network packet interface */

Definition at line 143 of file uhso.c.

◆ UHSO_PORT_SERIAL

#define UHSO_PORT_SERIAL   0x01 /* Serial port */

Definition at line 142 of file uhso.c.

◆ UHSO_PORT_TYPE_APP

#define UHSO_PORT_TYPE_APP   0x02

Definition at line 163 of file uhso.c.

◆ UHSO_PORT_TYPE_APP2

#define UHSO_PORT_TYPE_APP2   0x03

Definition at line 164 of file uhso.c.

◆ UHSO_PORT_TYPE_CTL

#define UHSO_PORT_TYPE_CTL   0x01

Definition at line 162 of file uhso.c.

◆ UHSO_PORT_TYPE_DIAG

#define UHSO_PORT_TYPE_DIAG   0x06

Definition at line 167 of file uhso.c.

◆ UHSO_PORT_TYPE_DIAG2

#define UHSO_PORT_TYPE_DIAG2   0x07

Definition at line 168 of file uhso.c.

◆ UHSO_PORT_TYPE_GPS

#define UHSO_PORT_TYPE_GPS   0x08

Definition at line 169 of file uhso.c.

◆ UHSO_PORT_TYPE_GPSCTL

#define UHSO_PORT_TYPE_GPSCTL   0x09

Definition at line 170 of file uhso.c.

◆ UHSO_PORT_TYPE_MAX

#define UHSO_PORT_TYPE_MAX   0x0c

Definition at line 174 of file uhso.c.

◆ UHSO_PORT_TYPE_MODEM

#define UHSO_PORT_TYPE_MODEM   0x04

Definition at line 165 of file uhso.c.

◆ UHSO_PORT_TYPE_MSD

#define UHSO_PORT_TYPE_MSD   0x0b

Definition at line 172 of file uhso.c.

◆ UHSO_PORT_TYPE_NETWORK

#define UHSO_PORT_TYPE_NETWORK   0x05

Definition at line 166 of file uhso.c.

◆ UHSO_PORT_TYPE_PCSC

#define UHSO_PORT_TYPE_PCSC   0x0a

Definition at line 171 of file uhso.c.

◆ UHSO_PORT_TYPE_UNKNOWN

#define UHSO_PORT_TYPE_UNKNOWN   0x00

Definition at line 161 of file uhso.c.

◆ UHSO_PORT_TYPE_VOICE

#define UHSO_PORT_TYPE_VOICE   0x0c

Definition at line 173 of file uhso.c.

◆ UHSO_PORT_UNKNOWN

#define UHSO_PORT_UNKNOWN   0x00

Definition at line 141 of file uhso.c.

◆ UHSO_STATIC_IFACE

#define UHSO_STATIC_IFACE   0x01

Definition at line 247 of file uhso.c.

◆ USB_DEBUG_VAR

#define USB_DEBUG_VAR   uhso_debug

Definition at line 65 of file uhso.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
UHSO_MUX_ENDPT_INTR 
UHSO_MUX_ENDPT_MAX 

Definition at line 330 of file uhso.c.

◆ anonymous enum

anonymous enum
Enumerator
UHSO_CTRL_READ 
UHSO_CTRL_WRITE 
UHSO_CTRL_MAX 

Definition at line 335 of file uhso.c.

◆ anonymous enum

anonymous enum
Enumerator
UHSO_IFNET_READ 
UHSO_IFNET_WRITE 
UHSO_IFNET_MAX 

Definition at line 341 of file uhso.c.

◆ anonymous enum

anonymous enum
Enumerator
UHSO_BULK_ENDPT_READ 
UHSO_BULK_ENDPT_WRITE 
UHSO_BULK_ENDPT_INTR 
UHSO_BULK_ENDPT_MAX 

Definition at line 347 of file uhso.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DRIVER_MODULE()

DRIVER_MODULE ( uhso  ,
uhub  ,
uhso_driver  ,
uhso_devclass  ,
uhso_driver_loaded  ,
 
)

◆ MODULE_DEPEND() [1/2]

MODULE_DEPEND ( uhso  ,
ucom  ,
,
,
 
)

◆ MODULE_DEPEND() [2/2]

MODULE_DEPEND ( uhso  ,
usb  ,
,
,
 
)

◆ MODULE_VERSION()

MODULE_VERSION ( uhso  ,
 
)

◆ SYSCTL_INT()

SYSCTL_INT ( _hw_usb_uhso  ,
OID_AUTO  ,
auto_switch  ,
CTLFLAG_RWTUN  ,
uhso_autoswitch,
,
"Automatically switch to modem mode"   
)

◆ SYSCTL_NODE()

static SYSCTL_NODE ( _hw_usb  ,
OID_AUTO  ,
uhso  ,
CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
"USB uhso"   
)
static

◆ UCOM_UNLOAD_DRAIN()

UCOM_UNLOAD_DRAIN ( uhso  )

◆ uhso_alloc_tty()

static int uhso_alloc_tty ( struct uhso_softc sc)
static

Definition at line 1012 of file uhso.c.

References uhso_tty::ht_sc, uhso_softc::sc_tty, uhso_softc::sc_ttys, uhso_softc::sc_ucom, and UHSO_DPRINTF.

Referenced by uhso_attach_bulkserial(), and uhso_attach_muxserial().

Here is the caller graph for this function:

◆ uhso_attach()

◆ uhso_attach_bulkserial()

static int uhso_attach_bulkserial ( struct uhso_softc sc,
struct usb_interface iface,
int  type 
)
static

◆ uhso_attach_ifnet()

static int uhso_attach_ifnet ( struct uhso_softc sc,
struct usb_interface iface,
int  type 
)
static

◆ uhso_attach_muxserial()

static int uhso_attach_muxserial ( struct uhso_softc sc,
struct usb_interface iface,
int  type 
)
static

◆ uhso_bs_cfg()

static void uhso_bs_cfg ( struct uhso_softc sc)
static

◆ uhso_bs_intr_callback()

◆ uhso_bs_read_callback()

◆ uhso_bs_write_callback()

static void uhso_bs_write_callback ( struct usb_xfer xfer,
usb_error_t  error 
)
static

◆ uhso_detach()

◆ uhso_driver_loaded()

static int uhso_driver_loaded ( struct module *  mod,
int  what,
void *  arg 
)
static

Definition at line 753 of file uhso.c.

References uhso_etag, uhso_ifnet_unit, and uhso_test_autoinst().

Here is the call graph for this function:

◆ uhso_free()

static void uhso_free ( struct ucom_softc ucom)
static

Definition at line 722 of file uhso.c.

References ucom_softc::sc_parent, and uhso_free_softc().

Here is the call graph for this function:

◆ uhso_free_softc()

static void uhso_free_softc ( struct uhso_softc sc)
static

Definition at line 711 of file uhso.c.

References uhso_softc::sc_mtx, uhso_softc::sc_super_ucom, uhso_softc::sc_tty, uhso_softc::sc_ucom, and ucom_unref().

Referenced by uhso_detach(), and uhso_free().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uhso_if_init()

static void uhso_if_init ( void *  priv)
static

Definition at line 1873 of file uhso.c.

References uhso_softc::sc_ifp, uhso_softc::sc_mtx, UHSO_DPRINTF, and uhso_if_stop().

Referenced by uhso_attach_ifnet(), and uhso_if_ioctl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uhso_if_ioctl()

static int uhso_if_ioctl ( struct ifnet *  ifp,
u_long  cmd,
caddr_t  data 
)
static

Definition at line 1841 of file uhso.c.

References uhso_softc::sc_mtx, uhso_if_init(), and uhso_if_stop().

Referenced by uhso_attach_ifnet().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uhso_if_output()

static int uhso_if_output ( struct ifnet *  ifp,
struct mbuf *  m0,
const struct sockaddr *  dst,
struct route *  ro 
)
static

Definition at line 1889 of file uhso.c.

References error.

Referenced by uhso_attach_ifnet().

Here is the caller graph for this function:

◆ uhso_if_rxflush()

static void uhso_if_rxflush ( void *  arg)
static

Definition at line 1664 of file uhso.c.

References uhso_softc::sc_ifp, uhso_softc::sc_mtx, uhso_softc::sc_mwait, uhso_softc::sc_rxq, UHSO_DPRINTF, and UHSO_HEXDUMP.

Referenced by uhso_attach_ifnet().

Here is the caller graph for this function:

◆ uhso_if_start()

static void uhso_if_start ( struct ifnet *  ifp)
static

Definition at line 1913 of file uhso.c.

References uhso_softc::sc_if_xfer, uhso_softc::sc_mtx, UHSO_DPRINTF, UHSO_IFNET_READ, UHSO_IFNET_WRITE, and usbd_transfer_start().

Referenced by uhso_attach_ifnet().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uhso_if_stop()

static void uhso_if_stop ( struct uhso_softc sc)
static

Definition at line 1930 of file uhso.c.

References uhso_softc::sc_if_xfer, uhso_softc::sc_ifp, UHSO_IFNET_READ, UHSO_IFNET_WRITE, and usbd_transfer_stop().

Referenced by uhso_detach(), uhso_if_init(), and uhso_if_ioctl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uhso_ifnet_read_callback()

◆ uhso_ifnet_write_callback()

static void uhso_ifnet_write_callback ( struct usb_xfer xfer,
usb_error_t  error 
)
static

◆ uhso_mux_intr_callback()

◆ uhso_mux_read_callback()

◆ uhso_mux_write_callback()

◆ uhso_probe()

◆ uhso_probe_iface()

◆ uhso_probe_iface_auto()

◆ uhso_probe_iface_static()

static int uhso_probe_iface_static ( struct usb_device udev,
int  index 
)
static

Definition at line 847 of file uhso.c.

References usb_config_descriptor::bNumInterface, index, UHSO_IF_BULK, UHSO_IF_MUX, UHSO_IF_NET, UHSO_IFACE_SPEC, UHSO_PORT_NETWORK, UHSO_PORT_SERIAL, UHSO_PORT_TYPE_DIAG, UHSO_PORT_TYPE_DIAG2, UHSO_PORT_TYPE_MODEM, UHSO_PORT_TYPE_NETWORK, and usbd_get_config_descriptor().

Referenced by uhso_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uhso_radio_ctrl()

static int uhso_radio_ctrl ( struct uhso_softc sc,
int  onoff 
)
static

Definition at line 966 of file uhso.c.

References req, uhso_softc::sc_dev, uhso_softc::sc_udev, usbd_do_request, usbd_errstr(), USETW, and UT_VENDOR.

Referenced by uhso_radio_sysctl().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uhso_radio_sysctl()

static int uhso_radio_sysctl ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 987 of file uhso.c.

References error, req, uhso_softc::sc_radio, and uhso_radio_ctrl().

Referenced by uhso_attach().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uhso_test_autoinst()

static void uhso_test_autoinst ( void *  arg,
struct usb_device udev,
struct usb_attach_arg uaa 
)
static

Definition at line 728 of file uhso.c.

References usb_attach_arg::dev_state, id, usb_interface::idesc, MSC_EJECT_REZERO, UAA_DEV_EJECTING, UAA_DEV_READY, uhso_autoswitch, uhso_devs, UICLASS_MASS, usb_msc_eject(), usbd_get_iface(), and usbd_lookup_id_by_uaa().

Referenced by uhso_driver_loaded().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ uhso_ucom_cfg_get_status()

static void uhso_ucom_cfg_get_status ( struct ucom_softc ucom,
uint8_t *  lsr,
uint8_t *  msr 
)
static

Definition at line 1439 of file uhso.c.

References uhso_softc::sc_lsr, uhso_softc::sc_msr, and ucom_softc::sc_parent.

◆ uhso_ucom_cfg_set_dtr()

static void uhso_ucom_cfg_set_dtr ( struct ucom_softc ucom,
uint8_t  onoff 
)
static

Definition at line 1448 of file uhso.c.

References uhso_softc::sc_line, ucom_softc::sc_parent, uhso_softc::sc_type, UCDC_LINE_DTR, uhso_bs_cfg(), UHSO_IF_BULK, and UHSO_IFACE_USB_TYPE.

Here is the call graph for this function:

◆ uhso_ucom_cfg_set_rts()

static void uhso_ucom_cfg_set_rts ( struct ucom_softc ucom,
uint8_t  onoff 
)
static

Definition at line 1464 of file uhso.c.

References uhso_softc::sc_line, ucom_softc::sc_parent, uhso_softc::sc_type, UCDC_LINE_RTS, uhso_bs_cfg(), UHSO_IF_BULK, and UHSO_IFACE_USB_TYPE.

Here is the call graph for this function:

◆ uhso_ucom_start_read()

◆ uhso_ucom_start_write()

◆ uhso_ucom_stop_read()

◆ uhso_ucom_stop_write()

static void uhso_ucom_stop_write ( struct ucom_softc ucom)
static

◆ USB_PNP_HOST_INFO()

USB_PNP_HOST_INFO ( uhso_devs  )

Variable Documentation

◆ uhso_attach

device_attach_t uhso_attach
static

Definition at line 481 of file uhso.c.

◆ uhso_autoswitch

int uhso_autoswitch = 1
static

Definition at line 293 of file uhso.c.

Referenced by uhso_test_autoinst().

◆ uhso_bs_config

const struct usb_config uhso_bs_config[UHSO_BULK_ENDPT_MAX]
static
Initial value:
= {
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
.flags = { .pipe_bof = 1, .short_xfer_ok = 1 },
.bufsize = 4096,
.callback = &uhso_bs_read_callback
},
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_OUT,
.flags = { .pipe_bof = 1, .force_short_xfer = 1 },
.bufsize = 8192,
},
.type = UE_INTERRUPT,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
.flags = { .short_xfer_ok = 1 },
.bufsize = 0,
.callback = &uhso_bs_intr_callback,
}
}
@ UHSO_BULK_ENDPT_WRITE
Definition: uhso.c:349
@ UHSO_BULK_ENDPT_INTR
Definition: uhso.c:350
@ UHSO_BULK_ENDPT_READ
Definition: uhso.c:348
static usb_callback_t uhso_bs_read_callback
Definition: uhso.c:357
static usb_callback_t uhso_bs_intr_callback
Definition: uhso.c:359
static usb_callback_t uhso_bs_write_callback
Definition: uhso.c:358
#define UE_INTERRUPT
Definition: usb.h:544
#define UE_ADDR_ANY
Definition: usb.h:537
#define UE_BULK
Definition: usb.h:543
#define UE_DIR_IN
Definition: usb.h:531
#define UE_DIR_OUT
Definition: usb.h:532

Definition at line 419 of file uhso.c.

Referenced by uhso_attach_bulkserial().

◆ uhso_bs_intr_callback

usb_callback_t uhso_bs_intr_callback
static

Definition at line 359 of file uhso.c.

◆ uhso_bs_read_callback

usb_callback_t uhso_bs_read_callback
static

Definition at line 357 of file uhso.c.

◆ uhso_bs_write_callback

usb_callback_t uhso_bs_write_callback
static

Definition at line 358 of file uhso.c.

◆ uhso_ctrl_config

const struct usb_config uhso_ctrl_config[UHSO_CTRL_MAX]
static
Initial value:
= {
.type = UE_CONTROL,
.endpoint = 0x00,
.direction = UE_DIR_ANY,
.flags = { .pipe_bof = 1, .short_xfer_ok = 1 },
.bufsize = sizeof(struct usb_device_request) + 1024,
},
.type = UE_CONTROL,
.endpoint = 0x00,
.direction = UE_DIR_ANY,
.flags = { .pipe_bof = 1, .force_short_xfer = 1 },
.bufsize = sizeof(struct usb_device_request) + 1024,
.timeout = 1000,
}
}
static usb_callback_t uhso_mux_read_callback
Definition: uhso.c:355
static usb_callback_t uhso_mux_write_callback
Definition: uhso.c:356
@ UHSO_CTRL_READ
Definition: uhso.c:336
@ UHSO_CTRL_WRITE
Definition: uhso.c:337
#define UE_DIR_ANY
Definition: usb.h:535
#define UE_CONTROL
Definition: usb.h:541

Definition at line 364 of file uhso.c.

Referenced by uhso_attach(), and uhso_attach_muxserial().

◆ uhso_detach

device_detach_t uhso_detach
static

Definition at line 482 of file uhso.c.

Referenced by uhso_attach().

◆ uhso_devclass

devclass_t uhso_devclass
static

Definition at line 498 of file uhso.c.

◆ uhso_devs

const STRUCT_USB_HOST_ID uhso_devs[]
static

Definition at line 253 of file uhso.c.

Referenced by uhso_probe(), and uhso_test_autoinst().

◆ uhso_driver

driver_t uhso_driver
static
Initial value:
= {
.name = "uhso",
.methods = uhso_methods,
.size = sizeof(struct uhso_softc)
}
static device_method_t uhso_methods[]
Definition: uhso.c:485

Definition at line 492 of file uhso.c.

◆ uhso_etag

eventhandler_tag uhso_etag
static

Definition at line 176 of file uhso.c.

Referenced by uhso_driver_loaded().

◆ uhso_ifnet_config

const struct usb_config uhso_ifnet_config[UHSO_IFNET_MAX]
static
Initial value:
= {
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
.flags = { .pipe_bof = 1, .short_xfer_ok = 1 },
.bufsize = MCLBYTES,
},
.type = UE_BULK,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_OUT,
.flags = { .pipe_bof = 1, .force_short_xfer = 1 },
.bufsize = MCLBYTES,
.timeout = 5 * USB_MS_HZ,
}
}
static usb_callback_t uhso_ifnet_read_callback
Definition: uhso.c:360
@ UHSO_IFNET_READ
Definition: uhso.c:342
@ UHSO_IFNET_WRITE
Definition: uhso.c:343
static usb_callback_t uhso_ifnet_write_callback
Definition: uhso.c:361
#define USB_MS_HZ
Definition: usbdi.h:118

Definition at line 398 of file uhso.c.

Referenced by uhso_attach_ifnet().

◆ uhso_ifnet_read_callback

usb_callback_t uhso_ifnet_read_callback
static

Definition at line 360 of file uhso.c.

◆ uhso_ifnet_unit

struct unrhdr* uhso_ifnet_unit = NULL
static

Definition at line 251 of file uhso.c.

Referenced by uhso_attach_ifnet(), uhso_detach(), and uhso_driver_loaded().

◆ uhso_ifnet_write_callback

usb_callback_t uhso_ifnet_write_callback
static

Definition at line 361 of file uhso.c.

◆ uhso_methods

device_method_t uhso_methods[]
static
Initial value:
= {
DEVMETHOD(device_probe, uhso_probe),
DEVMETHOD(device_attach, uhso_attach),
DEVMETHOD(device_detach, uhso_detach),
{ 0, 0 }
}
static device_detach_t uhso_detach
Definition: uhso.c:482
static device_probe_t uhso_probe
Definition: uhso.c:480
static device_attach_t uhso_attach
Definition: uhso.c:481

Definition at line 485 of file uhso.c.

◆ uhso_mux_config

const struct usb_config uhso_mux_config[UHSO_MUX_ENDPT_MAX]
static
Initial value:
= {
.type = UE_INTERRUPT,
.endpoint = UE_ADDR_ANY,
.direction = UE_DIR_IN,
.flags = { .short_xfer_ok = 1 },
.bufsize = 0,
.callback = &uhso_mux_intr_callback,
}
}
static usb_callback_t uhso_mux_intr_callback
Definition: uhso.c:354
@ UHSO_MUX_ENDPT_INTR
Definition: uhso.c:331

Definition at line 386 of file uhso.c.

Referenced by uhso_attach_muxserial().

◆ uhso_mux_intr_callback

usb_callback_t uhso_mux_intr_callback
static

Definition at line 354 of file uhso.c.

◆ uhso_mux_port_map

unsigned char uhso_mux_port_map[]
static
Initial value:
= {
}
#define UHSO_PORT_TYPE_APP2
Definition: uhso.c:164
#define UHSO_PORT_TYPE_PCSC
Definition: uhso.c:171
#define UHSO_PORT_TYPE_CTL
Definition: uhso.c:162
#define UHSO_PORT_TYPE_GPS
Definition: uhso.c:169
#define UHSO_PORT_TYPE_APP
Definition: uhso.c:163

Definition at line 207 of file uhso.c.

Referenced by uhso_attach().

◆ uhso_mux_read_callback

usb_callback_t uhso_mux_read_callback
static

Definition at line 355 of file uhso.c.

◆ uhso_mux_write_callback

usb_callback_t uhso_mux_write_callback
static

Definition at line 356 of file uhso.c.

◆ uhso_port

char* uhso_port[]
static
Initial value:
= {
"Unknown",
"Serial",
"Network",
"Network/Serial"
}

Definition at line 179 of file uhso.c.

Referenced by uhso_attach().

◆ uhso_port_map

unsigned char uhso_port_map[]
static
Initial value:
= {
}
#define UHSO_PORT_TYPE_MODEM
Definition: uhso.c:165
#define UHSO_PORT_TYPE_VOICE
Definition: uhso.c:173
#define UHSO_PORT_TYPE_MSD
Definition: uhso.c:172
#define UHSO_PORT_TYPE_UNKNOWN
Definition: uhso.c:161
#define UHSO_PORT_TYPE_NETWORK
Definition: uhso.c:166
#define UHSO_PORT_TYPE_DIAG
Definition: uhso.c:167
#define UHSO_PORT_TYPE_GPSCTL
Definition: uhso.c:170

Definition at line 191 of file uhso.c.

Referenced by uhso_probe_iface_auto().

◆ uhso_port_map_max

char uhso_port_map_max = sizeof(uhso_port_map) / sizeof(char)
static

Definition at line 205 of file uhso.c.

Referenced by uhso_probe_iface_auto().

◆ uhso_port_type

char* uhso_port_type[]
static
Initial value:
= {
"Unknown",
"Control",
"Application",
"Application (Secondary)",
"Modem",
"Network",
"Diagnostic",
"Diagnostic (Secondary)",
"GPS",
"GPS Control",
"PC Smartcard",
"MSD",
"Voice",
}

Definition at line 215 of file uhso.c.

Referenced by uhso_attach(), and uhso_probe_iface_auto().

◆ uhso_port_type_sysctl

char* uhso_port_type_sysctl[]
static
Initial value:
= {
"unknown",
"control",
"application",
"application",
"modem",
"network",
"diagnostic",
"diagnostic",
"gps",
"gps_control",
"pcsc",
"msd",
"voice",
}

Definition at line 231 of file uhso.c.

Referenced by uhso_attach().

◆ uhso_probe

device_probe_t uhso_probe
static

Definition at line 480 of file uhso.c.

◆ uhso_ucom_callback

struct ucom_callback uhso_ucom_callback
static
Initial value:
= {
.ucom_cfg_get_status = &uhso_ucom_cfg_get_status,
.ucom_cfg_set_dtr = &uhso_ucom_cfg_set_dtr,
.ucom_cfg_set_rts = &uhso_ucom_cfg_set_rts,
.ucom_start_read = uhso_ucom_start_read,
.ucom_stop_read = uhso_ucom_stop_read,
.ucom_start_write = uhso_ucom_start_write,
.ucom_stop_write = uhso_ucom_stop_write,
.ucom_free = &uhso_free,
}
static void uhso_ucom_cfg_set_dtr(struct ucom_softc *, uint8_t)
Definition: uhso.c:1448
static void uhso_free(struct ucom_softc *)
Definition: uhso.c:722
static void uhso_ucom_stop_read(struct ucom_softc *)
Definition: uhso.c:1500
static void uhso_ucom_start_write(struct ucom_softc *)
Definition: uhso.c:1519
static void uhso_ucom_cfg_get_status(struct ucom_softc *, uint8_t *, uint8_t *)
Definition: uhso.c:1439
static void uhso_ucom_cfg_set_rts(struct ucom_softc *, uint8_t)
Definition: uhso.c:1464
static void uhso_ucom_stop_write(struct ucom_softc *)
Definition: uhso.c:1540
static void uhso_ucom_start_read(struct ucom_softc *)
Definition: uhso.c:1480

Definition at line 505 of file uhso.c.

Referenced by uhso_probe_iface().