#include <sys/cdefs.h>
#include <sys/stdint.h>
#include <sys/stddef.h>
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/types.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 <sys/syslog.h>
#include <sys/selinfo.h>
#include <sys/conf.h>
#include <sys/fcntl.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
#include <dev/usb/usbhid.h>
#include "usbdevs.h"
#include <dev/usb/usb_debug.h>
#include <dev/usb/usb_process.h>
Go to the source code of this file.
|
| __FBSDID ("$FreeBSD$") |
|
static void | ulpt_reset (struct ulpt_softc *) |
|
static void | ulpt_watchdog (void *) |
|
static void | ulpt_write_callback (struct usb_xfer *xfer, usb_error_t error) |
|
static void | ulpt_read_callback (struct usb_xfer *xfer, usb_error_t error) |
|
static void | ulpt_status_callback (struct usb_xfer *xfer, usb_error_t error) |
|
static void | ulpt_start_read (struct usb_fifo *fifo) |
|
static void | ulpt_stop_read (struct usb_fifo *fifo) |
|
static void | ulpt_start_write (struct usb_fifo *fifo) |
|
static void | ulpt_stop_write (struct usb_fifo *fifo) |
|
static int | ulpt_open (struct usb_fifo *fifo, int fflags) |
|
static int | unlpt_open (struct usb_fifo *fifo, int fflags) |
|
static void | ulpt_close (struct usb_fifo *fifo, int fflags) |
|
static int | ulpt_ioctl (struct usb_fifo *fifo, u_long cmd, void *data, int fflags) |
|
static int | ulpt_probe (device_t dev) |
|
static int | ulpt_attach (device_t dev) |
|
static int | ulpt_detach (device_t dev) |
|
| DRIVER_MODULE (ulpt, uhub, ulpt_driver, ulpt_devclass, NULL, 0) |
|
| MODULE_DEPEND (ulpt, usb, 1, 1, 1) |
|
| MODULE_VERSION (ulpt, 1) |
|
| USB_PNP_HOST_INFO (ulpt_devs) |
|
◆ LPS_INVERT
◆ LPS_MASK
◆ LPS_NERR
#define LPS_NERR 0x08 /* printer no error */ |
◆ LPS_NOPAPER
#define LPS_NOPAPER 0x20 /* printer out of paper */ |
◆ LPS_SELECT
#define LPS_SELECT 0x10 /* printer selected */ |
◆ ULPT_BSIZE
#define ULPT_BSIZE (1<<15) /* bytes */ |
◆ ULPT_IFQ_MAXLEN
#define ULPT_IFQ_MAXLEN 2 /* units */ |
◆ UR_GET_DEVICE_ID
#define UR_GET_DEVICE_ID 0x00 |
◆ UR_GET_PORT_STATUS
#define UR_GET_PORT_STATUS 0x01 |
◆ UR_SOFT_RESET
#define UR_SOFT_RESET 0x02 |
◆ USB_DEBUG_VAR
#define USB_DEBUG_VAR ulpt_debug |
◆ anonymous enum
Enumerator |
---|
ULPT_BULK_DT_WR | |
ULPT_BULK_DT_RD | |
ULPT_INTR_DT_RD | |
ULPT_N_TRANSFER | |
Definition at line 98 of file ulpt.c.
◆ __FBSDID()
◆ DRIVER_MODULE()
◆ MODULE_DEPEND()
MODULE_DEPEND |
( |
ulpt |
, |
|
|
usb |
, |
|
|
1 |
, |
|
|
1 |
, |
|
|
1 |
|
|
) |
| |
◆ MODULE_VERSION()
MODULE_VERSION |
( |
ulpt |
, |
|
|
1 |
|
|
) |
| |
◆ ulpt_attach()
static int ulpt_attach |
( |
device_t |
dev | ) |
|
|
static |
Definition at line 523 of file ulpt.c.
References usb_config_descriptor::bConfigurationValue, usbd_lookup_info::bIfaceIndex, usbd_lookup_info::bIfaceNum, dev, usb_attach_arg::device, device_set_usb_desc(), DPRINTF, error, id, usb_attach_arg::iface, usb_attach_arg::info, len, req, ulpt_softc::sc_dev, ulpt_softc::sc_fifo, ulpt_softc::sc_fifo_noreset, ulpt_softc::sc_iface_no, ulpt_softc::sc_mtx, ulpt_softc::sc_udev, ulpt_softc::sc_watchdog, ulpt_softc::sc_xfer, UDESC_INTERFACE, UICLASS_PRINTER, UIPROTO_PRINTER_BI, UISUBCLASS_PRINTER, ulpt_config, ulpt_detach, ulpt_fifo_methods, ULPT_N_TRANSFER, ulpt_watchdog(), unlpt_fifo_methods, UR_GET_DEVICE_ID, usb_callout_init_mtx, USB_DEFAULT_TIMEOUT, usb_desc_foreach(), usb_fifo_attach(), USB_SHORT_XFER_OK, usbd_do_request_flags(), usbd_errstr(), usbd_get_config_descriptor(), usbd_get_interface_descriptor(), usbd_set_alt_interface_index(), usbd_transfer_setup(), USETW, USETW2, and UT_READ_CLASS_INTERFACE.
◆ ulpt_close()
static void ulpt_close |
( |
struct usb_fifo * |
fifo, |
|
|
int |
fflags |
|
) |
| |
|
static |
◆ ulpt_detach()
static int ulpt_detach |
( |
device_t |
dev | ) |
|
|
static |
Definition at line 659 of file ulpt.c.
References dev, DPRINTF, ulpt_softc::sc_fifo, ulpt_softc::sc_fifo_noreset, ulpt_softc::sc_mtx, ulpt_softc::sc_watchdog, ulpt_softc::sc_xfer, ULPT_N_TRANSFER, usb_callout_drain, usb_callout_stop, usb_fifo_detach(), and usbd_transfer_unsetup().
◆ ulpt_ioctl()
static int ulpt_ioctl |
( |
struct usb_fifo * |
fifo, |
|
|
u_long |
cmd, |
|
|
void * |
data, |
|
|
int |
fflags |
|
) |
| |
|
static |
◆ ulpt_open()
static int ulpt_open |
( |
struct usb_fifo * |
fifo, |
|
|
int |
fflags |
|
) |
| |
|
static |
◆ ulpt_probe()
static int ulpt_probe |
( |
device_t |
dev | ) |
|
|
static |
◆ ulpt_read_callback()
Definition at line 240 of file ulpt.c.
References DPRINTF, error, ulpt_softc::sc_fifo_open, ulpt_softc::sc_zlps, USB_ERR_CANCELLED, usb_fifo_put_bytes_max(), usb_fifo_put_data(), USB_FIFO_RX, 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_interval(), usbd_xfer_set_stall(), usbd_xfer_softc(), and usbd_xfer_status().
◆ ulpt_reset()
◆ ulpt_start_read()
static void ulpt_start_read |
( |
struct usb_fifo * |
fifo | ) |
|
|
static |
◆ ulpt_start_write()
static void ulpt_start_write |
( |
struct usb_fifo * |
fifo | ) |
|
|
static |
◆ ulpt_status_callback()
Definition at line 299 of file ulpt.c.
References DPRINTF, error, LPS_INVERT, LPS_MASK, LPS_NERR, LPS_NOPAPER, LPS_SELECT, req, ulpt_softc::sc_dev, ulpt_softc::sc_iface_no, ulpt_softc::sc_last_status, UR_GET_PORT_STATUS, USB_ERR_CANCELLED, USB_GET_STATE, USB_ST_SETUP, USB_ST_TRANSFERRED, usbd_copy_in(), usbd_copy_out(), usbd_errstr(), usbd_transfer_submit(), usbd_xfer_get_frame(), usbd_xfer_set_frame_len(), usbd_xfer_set_frames(), usbd_xfer_softc(), USETW, and UT_READ_CLASS_INTERFACE.
◆ ulpt_stop_read()
static void ulpt_stop_read |
( |
struct usb_fifo * |
fifo | ) |
|
|
static |
◆ ulpt_stop_write()
static void ulpt_stop_write |
( |
struct usb_fifo * |
fifo | ) |
|
|
static |
◆ ulpt_watchdog()
static void ulpt_watchdog |
( |
void * |
arg | ) |
|
|
static |
◆ ulpt_write_callback()
Definition at line 201 of file ulpt.c.
References DPRINTF, error, ulpt_softc::sc_fifo_open, USB_ERR_CANCELLED, usb_fifo_get_data(), USB_FIFO_TX, 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().
◆ unlpt_open()
static int unlpt_open |
( |
struct usb_fifo * |
fifo, |
|
|
int |
fflags |
|
) |
| |
|
static |
Definition at line 431 of file ulpt.c.
References ulpt_softc::sc_fflags, ulpt_softc::sc_fifo_open, ulpt_softc::sc_mtx, ulpt_softc::sc_xfer, ULPT_BULK_DT_RD, ULPT_BULK_DT_WR, ULPT_IFQ_MAXLEN, usb_fifo_alloc_buffer(), USB_FIFO_RX, usb_fifo_softc(), USB_FIFO_TX, usbd_xfer_max_len(), and usbd_xfer_set_stall().
◆ USB_PNP_HOST_INFO()
◆ ulpt_attach
device_attach_t ulpt_attach |
|
static |
◆ ulpt_close
◆ ulpt_config
Initial value:= {
.flags = {.pipe_bof = 1,.proxy_buffer = 1},
},
.flags = {.pipe_bof = 1,.short_xfer_ok = 1,.proxy_buffer = 1},
},
.endpoint = 0x00,
.timeout = 1000,
},
}
static usb_callback_t ulpt_write_callback
static usb_callback_t ulpt_status_callback
static usb_callback_t ulpt_read_callback
Definition at line 354 of file ulpt.c.
Referenced by ulpt_attach().
◆ ulpt_detach
device_detach_t ulpt_detach |
|
static |
◆ ulpt_devclass
◆ ulpt_devs
Initial value:= {
}
#define UIPROTO_PRINTER_1284
#define UISUBCLASS_PRINTER
#define UIPROTO_PRINTER_BI
#define UIPROTO_PRINTER_UNI
#define USB_IFACE_SUBCLASS(isc)
#define USB_IFACE_CLASS(ic)
#define USB_IFACE_PROTOCOL(ip)
Definition at line 487 of file ulpt.c.
Referenced by ulpt_probe().
◆ ulpt_driver
Initial value:= {
.name = "ulpt",
}
static device_method_t ulpt_methods[]
Definition at line 752 of file ulpt.c.
◆ ulpt_fifo_methods
Initial value:= {
.basename[0] = "ulpt",
}
static usb_fifo_close_t ulpt_close
static usb_fifo_ioctl_t ulpt_ioctl
static usb_fifo_cmd_t ulpt_start_read
static usb_fifo_cmd_t ulpt_start_write
static usb_fifo_cmd_t ulpt_stop_read
static usb_fifo_cmd_t ulpt_stop_write
static usb_fifo_open_t ulpt_open
Definition at line 146 of file ulpt.c.
Referenced by ulpt_attach().
◆ ulpt_ioctl
◆ ulpt_methods
device_method_t ulpt_methods[] |
|
static |
Initial value:= {
DEVMETHOD_END
}
static device_attach_t ulpt_attach
static device_detach_t ulpt_detach
static device_probe_t ulpt_probe
Definition at line 745 of file ulpt.c.
◆ ulpt_open
◆ ulpt_probe
device_probe_t ulpt_probe |
|
static |
◆ ulpt_read_callback
◆ ulpt_start_read
◆ ulpt_start_write
◆ ulpt_status_callback
◆ ulpt_stop_read
◆ ulpt_stop_write
◆ ulpt_write_callback
◆ unlpt_fifo_methods
Initial value:= {
.basename[0] = "unlpt",
}
static usb_fifo_open_t unlpt_open
Definition at line 157 of file ulpt.c.
Referenced by ulpt_attach().
◆ unlpt_open