FreeBSD kernel usb device Code
|
#include <sys/param.h>
#include <sys/eventhandler.h>
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/queue.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/module.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/condvar.h>
#include <sys/sysctl.h>
#include <sys/sx.h>
#include <sys/unistd.h>
#include <sys/callout.h>
#include <sys/malloc.h>
#include <sys/priv.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_msctest.h>
#include <dev/usb/serial/usb_serial.h>
#include <dev/usb/quirk/usb_quirk.h>
Go to the source code of this file.
Data Structures | |
struct | u3g_softc |
Macros | |
#define | USB_DEBUG_VAR u3g_debug |
#define | U3G_MAXPORTS 12 |
#define | U3G_CONFIG_INDEX 0 |
#define | U3G_BSIZE 2048 |
#define | U3G_TXSIZE (U3G_BSIZE / U3G_TXFRAMES) |
#define | U3G_TXFRAMES 4 |
#define | U3GINIT_HUAWEI 1 /* Requires Huawei init command */ |
#define | U3GINIT_SIERRA 2 /* Requires Sierra init command */ |
#define | U3GINIT_SCSIEJECT 3 /* Requires SCSI eject command */ |
#define | U3GINIT_REZERO 4 /* Requires SCSI rezero command */ |
#define | U3GINIT_ZTESTOR 5 /* Requires ZTE SCSI command */ |
#define | U3GINIT_CMOTECH 6 /* Requires CMOTECH SCSI command */ |
#define | U3GINIT_WAIT 7 /* Device reappears after a delay */ |
#define | U3GINIT_SAEL_M460 8 /* Requires vendor init */ |
#define | U3GINIT_HUAWEISCSI 9 /* Requires Huawei SCSI init command */ |
#define | U3GINIT_HUAWEISCSI2 10 /* Requires Huawei SCSI init command (2) */ |
#define | U3GINIT_TCT 11 /* Requires TCT Mobile init command */ |
#define | U3G_DEV(v, p, i) { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } |
Enumerations | |
enum | { U3G_BULK_WR , U3G_BULK_RD , U3G_INTR , U3G_N_TRANSFER } |
Functions | |
static void | u3g_free_softc (struct u3g_softc *) |
static void | u3g_cfg_get_status (struct ucom_softc *, uint8_t *, uint8_t *) |
static void | u3g_cfg_set_dtr (struct ucom_softc *, uint8_t) |
static void | u3g_cfg_set_rts (struct ucom_softc *, uint8_t) |
static void | u3g_start_read (struct ucom_softc *ucom) |
static void | u3g_stop_read (struct ucom_softc *ucom) |
static void | u3g_start_write (struct ucom_softc *ucom) |
static void | u3g_stop_write (struct ucom_softc *ucom) |
static void | u3g_poll (struct ucom_softc *ucom) |
static void | u3g_free (struct ucom_softc *ucom) |
static void | u3g_test_autoinst (void *, struct usb_device *, struct usb_attach_arg *) |
static int | u3g_driver_loaded (struct module *mod, int what, void *arg) |
DRIVER_MODULE (u3g, uhub, u3g_driver, u3g_devclass, u3g_driver_loaded, 0) | |
MODULE_DEPEND (u3g, ucom, 1, 1, 1) | |
MODULE_DEPEND (u3g, usb, 1, 1, 1) | |
MODULE_VERSION (u3g, 1) | |
USB_PNP_HOST_INFO (u3g_devs) | |
static int | u3g_sierra_init (struct usb_device *udev) |
static int | u3g_huawei_init (struct usb_device *udev) |
static int | u3g_huawei_is_cdce (uint16_t idVendor, uint8_t bInterfaceSubClass, uint8_t bInterfaceProtocol) |
static void | u3g_sael_m460_init (struct usb_device *udev) |
static int | u3g_probe (device_t self) |
static int | u3g_attach (device_t dev) |
static int | u3g_detach (device_t dev) |
UCOM_UNLOAD_DRAIN (u3g) | |
static void | u3g_write_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | u3g_read_callback (struct usb_xfer *xfer, usb_error_t error) |
static void | u3g_cfg_set_line (struct ucom_softc *ucom) |
static void | u3g_intr_callback (struct usb_xfer *xfer, usb_error_t error) |
Variables | |
static device_probe_t | u3g_probe |
static device_attach_t | u3g_attach |
static device_detach_t | u3g_detach |
static usb_callback_t | u3g_write_callback |
static usb_callback_t | u3g_read_callback |
static usb_callback_t | u3g_intr_callback |
static eventhandler_tag | u3g_etag |
static const struct usb_config | u3g_config [U3G_N_TRANSFER] |
static const struct ucom_callback | u3g_callback |
static device_method_t | u3g_methods [] |
static devclass_t | u3g_devclass |
static driver_t | u3g_driver |
static const STRUCT_USB_HOST_ID | u3g_devs [] |
#define U3G_DEV | ( | v, | |
p, | |||
i | |||
) | { USB_VPI(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, i) } |
#define U3G_TXSIZE (U3G_BSIZE / U3G_TXFRAMES) |
#define U3GINIT_HUAWEISCSI 9 /* Requires Huawei SCSI init command */ |
#define U3GINIT_HUAWEISCSI2 10 /* Requires Huawei SCSI init command (2) */ |
anonymous enum |
DRIVER_MODULE | ( | u3g | , |
uhub | , | ||
u3g_driver | , | ||
u3g_devclass | , | ||
u3g_driver_loaded | , | ||
0 | |||
) |
MODULE_DEPEND | ( | u3g | , |
ucom | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_DEPEND | ( | u3g | , |
usb | , | ||
1 | , | ||
1 | , | ||
1 | |||
) |
MODULE_VERSION | ( | u3g | , |
1 | |||
) |
|
static |
Definition at line 904 of file u3g.c.
References usbd_lookup_info::bIfaceIndex, dev, usb_attach_arg::device, device_set_usb_desc(), DPRINTF, error, id, usbd_lookup_info::idVendor, usb_attach_arg::info, n, u3g_softc::sc_iface, u3g_softc::sc_mtx, u3g_softc::sc_numports, u3g_softc::sc_super_ucom, u3g_softc::sc_ucom, u3g_softc::sc_udev, u3g_softc::sc_xfer, type, U3G_BULK_RD, U3G_BULK_WR, u3g_callback, u3g_config, u3g_detach, u3g_huawei_is_cdce(), U3G_INTR, U3G_MAXPORTS, U3G_N_TRANSFER, u3g_sael_m460_init(), U3GINIT_SAEL_M460, ucom_attach(), ucom_ref(), ucom_set_pnpinfo_usb(), UICLASS_VENDOR, UQ_MSC_EJECT_SAEL_M460, USB_GET_DRIVER_INFO, USB_IFACE_MAX, usb_test_quirk(), usbd_get_iface(), usbd_get_interface_descriptor(), usbd_set_parent_iface(), usbd_transfer_setup(), and usbd_xfer_set_stall().
|
static |
Definition at line 1162 of file u3g.c.
References u3g_softc::sc_lsr, u3g_softc::sc_msr, ucom_softc::sc_parent, and ucom_softc::sc_subunit.
|
static |
Definition at line 1189 of file u3g.c.
References DPRINTF, u3g_softc::sc_line, ucom_softc::sc_parent, ucom_softc::sc_subunit, u3g_cfg_set_line(), and UCDC_LINE_DTR.
|
static |
Definition at line 1172 of file u3g.c.
References req, u3g_softc::sc_iface, u3g_softc::sc_line, ucom_softc::sc_parent, ucom_softc::sc_subunit, u3g_softc::sc_udev, UCDC_SET_CONTROL_LINE_STATE, ucom_cfg_do_request, USETW, and UT_WRITE_CLASS_INTERFACE.
Referenced by u3g_cfg_set_dtr(), and u3g_cfg_set_rts().
|
static |
Definition at line 1204 of file u3g.c.
References DPRINTF, u3g_softc::sc_line, ucom_softc::sc_parent, ucom_softc::sc_subunit, u3g_cfg_set_line(), and UCDC_LINE_RTS.
|
static |
Definition at line 1018 of file u3g.c.
References dev, DPRINTF, u3g_softc::sc_super_ucom, u3g_softc::sc_ucom, u3g_softc::sc_xfer, u3g_free_softc(), U3G_MAXPORTS, U3G_N_TRANSFER, ucom_detach(), and usbd_transfer_unsetup().
|
static |
Definition at line 865 of file u3g.c.
References u3g_etag, and u3g_test_autoinst().
|
static |
Definition at line 1050 of file u3g.c.
References ucom_softc::sc_parent, and u3g_free_softc().
|
static |
Definition at line 1041 of file u3g.c.
References u3g_softc::sc_mtx, u3g_softc::sc_super_ucom, and ucom_unref().
Referenced by u3g_detach(), and u3g_free().
|
static |
Definition at line 628 of file u3g.c.
References req, UF_DEVICE_REMOTE_WAKEUP, UHF_PORT_SUSPEND, UR_SET_FEATURE, USB_MS_HZ, usbd_do_request_flags(), USETW, and UT_WRITE_DEVICE.
Referenced by u3g_test_autoinst().
|
static |
Definition at line 646 of file u3g.c.
References bInterfaceProtocol, bInterfaceSubClass, and idVendor.
Referenced by u3g_attach(), and u3g_probe().
|
static |
Definition at line 1219 of file u3g.c.
References usb_cdc_notification::bmRequestType, usb_cdc_notification::bNotification, usb_cdc_notification::data, DPRINTF, error, u3g_softc::sc_lsr, u3g_softc::sc_msr, ucom_softc::sc_parent, ucom_softc::sc_subunit, UCDC_N_SERIAL_DCD, UCDC_N_SERIAL_DSR, UCDC_N_SERIAL_RI, UCDC_N_SERIAL_STATE, UCDC_NOTIFICATION, ucom_status_change(), UGETW, USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_copy_out(), usbd_transfer_submit(), usbd_xfer_get_frame(), usbd_xfer_max_len(), usbd_xfer_set_frame_len(), usbd_xfer_set_stall(), usbd_xfer_softc(), usbd_xfer_status(), and usb_cdc_notification::wLength.
|
static |
Definition at line 1287 of file u3g.c.
References ucom_softc::sc_parent, ucom_softc::sc_subunit, u3g_softc::sc_xfer, U3G_N_TRANSFER, and usbd_transfer_poll().
|
static |
Definition at line 883 of file u3g.c.
References usbd_lookup_info::bConfigIndex, usbd_lookup_info::bInterfaceClass, usbd_lookup_info::bInterfaceProtocol, usbd_lookup_info::bInterfaceSubClass, usbd_lookup_info::idVendor, usb_attach_arg::info, U3G_CONFIG_INDEX, u3g_devs, u3g_huawei_is_cdce(), UICLASS_VENDOR, usb_attach_arg::usb_mode, USB_MODE_HOST, and usbd_lookup_id_by_uaa().
|
static |
Definition at line 1132 of file u3g.c.
References error, ucom_put_data(), USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_transfer_submit(), usbd_xfer_get_frame(), usbd_xfer_max_len(), usbd_xfer_set_frame_len(), usbd_xfer_set_stall(), usbd_xfer_softc(), and usbd_xfer_status().
|
static |
Definition at line 685 of file u3g.c.
References len, n, req, UE_DIR_IN, UGETW, USB_ERR_TIMEOUT, usbd_do_request, and usbd_req_set_alt_interface_no().
Referenced by u3g_attach().
|
static |
Definition at line 610 of file u3g.c.
References req, UF_DEVICE_REMOTE_WAKEUP, UHF_PORT_CONNECTION, UR_SET_INTERFACE, USB_MS_HZ, usbd_do_request_flags(), USETW, and UT_VENDOR.
Referenced by u3g_test_autoinst().
|
static |
Definition at line 1056 of file u3g.c.
References ucom_softc::sc_parent, ucom_softc::sc_subunit, u3g_softc::sc_xfer, U3G_BULK_RD, U3G_INTR, and usbd_transfer_start().
|
static |
Definition at line 1080 of file u3g.c.
References ucom_softc::sc_parent, ucom_softc::sc_subunit, u3g_softc::sc_xfer, U3G_BULK_WR, and usbd_transfer_start().
|
static |
Definition at line 1068 of file u3g.c.
References ucom_softc::sc_parent, ucom_softc::sc_subunit, u3g_softc::sc_xfer, U3G_BULK_RD, U3G_INTR, and usbd_transfer_stop().
|
static |
Definition at line 1088 of file u3g.c.
References ucom_softc::sc_parent, ucom_softc::sc_subunit, u3g_softc::sc_xfer, U3G_BULK_WR, and usbd_transfer_stop().
|
static |
Definition at line 770 of file u3g.c.
References usb_attach_arg::dev_state, error, id, usb_interface::idesc, MSC_EJECT_CMOTECH, MSC_EJECT_HUAWEI, MSC_EJECT_HUAWEI2, MSC_EJECT_REZERO, MSC_EJECT_STOPUNIT, MSC_EJECT_TCT, MSC_EJECT_ZTESTOR, u3g_devs, u3g_huawei_init(), u3g_sierra_init(), U3GINIT_CMOTECH, U3GINIT_HUAWEI, U3GINIT_HUAWEISCSI, U3GINIT_HUAWEISCSI2, U3GINIT_REZERO, U3GINIT_SCSIEJECT, U3GINIT_SIERRA, U3GINIT_TCT, U3GINIT_WAIT, U3GINIT_ZTESTOR, UAA_DEV_EJECTING, UAA_DEV_READY, UICLASS_MASS, UQ_MSC_EJECT_CMOTECH, UQ_MSC_EJECT_HUAWEI, UQ_MSC_EJECT_HUAWEISCSI, UQ_MSC_EJECT_HUAWEISCSI2, UQ_MSC_EJECT_REZERO, UQ_MSC_EJECT_SCSIEJECT, UQ_MSC_EJECT_SIERRA, UQ_MSC_EJECT_TCT, UQ_MSC_EJECT_WAIT, UQ_MSC_EJECT_ZTESTOR, USB_GET_DRIVER_INFO, usb_get_manufacturer(), usb_get_product(), usb_msc_eject(), usb_test_quirk(), usbd_get_iface(), and usbd_lookup_id_by_uaa().
Referenced by u3g_driver_loaded().
|
static |
Definition at line 1096 of file u3g.c.
References error, U3G_TXFRAMES, U3G_TXSIZE, ucom_get_data(), USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_transfer_submit(), usbd_xfer_get_frame(), usbd_xfer_set_frame_len(), usbd_xfer_set_frame_offset(), usbd_xfer_set_frames(), usbd_xfer_set_stall(), and usbd_xfer_softc().
UCOM_UNLOAD_DRAIN | ( | u3g | ) |
USB_PNP_HOST_INFO | ( | u3g_devs | ) |
|
static |
Definition at line 172 of file u3g.c.
Referenced by u3g_attach().
|
static |
Definition at line 142 of file u3g.c.
Referenced by u3g_attach().
|
static |
Definition at line 119 of file u3g.c.
Referenced by u3g_attach().
|
static |
Definition at line 199 of file u3g.c.
Referenced by u3g_probe(), and u3g_test_autoinst().
|
static |
|
static |
Definition at line 140 of file u3g.c.
Referenced by u3g_driver_loaded().
|
static |
|
static |
|
static |
|
static |