Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/usb/net/uhso.c
Show First 20 Lines • Show All 282 Lines • ▼ Show 20 Lines | #define UHSO_DEV(v,p,i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } | ||||
UHSO_DEV(OPTION, GTICON322, UHSO_STATIC_IFACE), | UHSO_DEV(OPTION, GTICON322, UHSO_STATIC_IFACE), | ||||
/* Option iCON 505 */ | /* Option iCON 505 */ | ||||
UHSO_DEV(OPTION, ICON505, UHSO_AUTO_IFACE), | UHSO_DEV(OPTION, ICON505, UHSO_AUTO_IFACE), | ||||
/* Option iCON 452 */ | /* Option iCON 452 */ | ||||
UHSO_DEV(OPTION, ICON505, UHSO_AUTO_IFACE), | UHSO_DEV(OPTION, ICON505, UHSO_AUTO_IFACE), | ||||
#undef UHSO_DEV | #undef UHSO_DEV | ||||
}; | }; | ||||
static SYSCTL_NODE(_hw_usb, OID_AUTO, uhso, CTLFLAG_RW, 0, "USB uhso"); | static SYSCTL_NODE(_hw_usb, OID_AUTO, uhso, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, | ||||
"USB uhso"); | |||||
static int uhso_autoswitch = 1; | static int uhso_autoswitch = 1; | ||||
SYSCTL_INT(_hw_usb_uhso, OID_AUTO, auto_switch, CTLFLAG_RWTUN, | SYSCTL_INT(_hw_usb_uhso, OID_AUTO, auto_switch, CTLFLAG_RWTUN, | ||||
&uhso_autoswitch, 0, "Automatically switch to modem mode"); | &uhso_autoswitch, 0, "Automatically switch to modem mode"); | ||||
#ifdef USB_DEBUG | #ifdef USB_DEBUG | ||||
#ifdef UHSO_DEBUG | #ifdef UHSO_DEBUG | ||||
static int uhso_debug = UHSO_DEBUG; | static int uhso_debug = UHSO_DEBUG; | ||||
#else | #else | ||||
▲ Show 20 Lines • Show All 294 Lines • ▼ Show 20 Lines | uhso_attach(device_t self) | ||||
sctx = device_get_sysctl_ctx(sc->sc_dev); | sctx = device_get_sysctl_ctx(sc->sc_dev); | ||||
soid = device_get_sysctl_tree(sc->sc_dev); | soid = device_get_sysctl_tree(sc->sc_dev); | ||||
SYSCTL_ADD_STRING(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "type", | SYSCTL_ADD_STRING(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "type", | ||||
CTLFLAG_RD, uhso_port[UHSO_IFACE_PORT(sc->sc_type)], 0, | CTLFLAG_RD, uhso_port[UHSO_IFACE_PORT(sc->sc_type)], 0, | ||||
"Port available at this interface"); | "Port available at this interface"); | ||||
SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "radio", | SYSCTL_ADD_PROC(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "radio", | ||||
CTLTYPE_INT | CTLFLAG_RWTUN, sc, 0, uhso_radio_sysctl, "I", "Enable radio"); | CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_MPSAFE, sc, 0, | ||||
uhso_radio_sysctl, "I", "Enable radio"); | |||||
/* | /* | ||||
* The default interface description on most Option devices isn't | * The default interface description on most Option devices isn't | ||||
* very helpful. So we skip device_set_usb_desc and set the | * very helpful. So we skip device_set_usb_desc and set the | ||||
* device description manually. | * device description manually. | ||||
*/ | */ | ||||
device_set_desc_copy(self, uhso_port_type[UHSO_IFACE_PORT_TYPE(sc->sc_type)]); | device_set_desc_copy(self, uhso_port_type[UHSO_IFACE_PORT_TYPE(sc->sc_type)]); | ||||
/* Announce device */ | /* Announce device */ | ||||
device_printf(self, "<%s port> at <%s %s> on %s\n", | device_printf(self, "<%s port> at <%s %s> on %s\n", | ||||
uhso_port_type[UHSO_IFACE_PORT_TYPE(sc->sc_type)], | uhso_port_type[UHSO_IFACE_PORT_TYPE(sc->sc_type)], | ||||
usb_get_manufacturer(uaa->device), | usb_get_manufacturer(uaa->device), | ||||
usb_get_product(uaa->device), | usb_get_product(uaa->device), | ||||
device_get_nameunit(device_get_parent(self))); | device_get_nameunit(device_get_parent(self))); | ||||
if (sc->sc_ttys > 0) { | if (sc->sc_ttys > 0) { | ||||
SYSCTL_ADD_INT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "ports", | SYSCTL_ADD_INT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "ports", | ||||
CTLFLAG_RD, &sc->sc_ttys, 0, "Number of attached serial ports"); | CTLFLAG_RD, &sc->sc_ttys, 0, "Number of attached serial ports"); | ||||
tree = SYSCTL_ADD_NODE(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, | tree = SYSCTL_ADD_NODE(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, | ||||
"port", CTLFLAG_RD, NULL, "Serial ports"); | "port", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "Serial ports"); | ||||
} | } | ||||
/* | /* | ||||
* Loop through the number of found TTYs and create sysctl | * Loop through the number of found TTYs and create sysctl | ||||
* nodes for them. | * nodes for them. | ||||
*/ | */ | ||||
for (i = 0; i < sc->sc_ttys; i++) { | for (i = 0; i < sc->sc_ttys; i++) { | ||||
ht = &sc->sc_tty[i]; | ht = &sc->sc_tty[i]; | ||||
ucom = &sc->sc_ucom[i]; | ucom = &sc->sc_ucom[i]; | ||||
if (UHSO_IFACE_USB_TYPE(sc->sc_type) & UHSO_IF_MUX) | if (UHSO_IFACE_USB_TYPE(sc->sc_type) & UHSO_IF_MUX) | ||||
port = uhso_mux_port_map[ht->ht_muxport]; | port = uhso_mux_port_map[ht->ht_muxport]; | ||||
else | else | ||||
port = UHSO_IFACE_PORT_TYPE(sc->sc_type); | port = UHSO_IFACE_PORT_TYPE(sc->sc_type); | ||||
desc = uhso_port_type_sysctl[port]; | desc = uhso_port_type_sysctl[port]; | ||||
tty_node = SYSCTL_ADD_NODE(sctx, SYSCTL_CHILDREN(tree), OID_AUTO, | tty_node = SYSCTL_ADD_NODE(sctx, SYSCTL_CHILDREN(tree), OID_AUTO, | ||||
desc, CTLFLAG_RD, NULL, ""); | desc, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, ""); | ||||
ht->ht_name[0] = 0; | ht->ht_name[0] = 0; | ||||
if (sc->sc_ttys == 1) | if (sc->sc_ttys == 1) | ||||
snprintf(ht->ht_name, 32, "cuaU%d", ucom->sc_super->sc_unit); | snprintf(ht->ht_name, 32, "cuaU%d", ucom->sc_super->sc_unit); | ||||
else { | else { | ||||
snprintf(ht->ht_name, 32, "cuaU%d.%d", | snprintf(ht->ht_name, 32, "cuaU%d.%d", | ||||
ucom->sc_super->sc_unit, ucom->sc_subunit); | ucom->sc_super->sc_unit, ucom->sc_subunit); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,288 Lines • Show Last 20 Lines |