summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2007-06-21 14:42:34 +0000
committerimp <imp@FreeBSD.org>2007-06-21 14:42:34 +0000
commitd4fd7053d478e89ca3be425ced1a36ebf68d553e (patch)
treeed0dd4914af2fd4bc48d4d26d7e7b701359acf47 /sys
parentac6798a72c8fe23cdd0de3feb6488518edba738c (diff)
downloadFreeBSD-src-d4fd7053d478e89ca3be425ced1a36ebf68d553e.zip
FreeBSD-src-d4fd7053d478e89ca3be425ced1a36ebf68d553e.tar.gz
Latest round of usb cleanups:
o Consistently use device_foo_t and bus_foo_t for functions implementing device_foo and bus_foo respectively. Adjust those routines that were wrong (we should do this throughout the tree). o make all the modules depend on usb. Otherwise these modules won't load. o ucycom doesn't need usb_port.h o Minor unifdefing o uhub, umass, ums, urio, uscanner conversion complete. o ukbd: Remove the NO_SET_PROTO quirk (fixes a PR 77940). NetBSD removed their check and setting the proto a long time ago. o umodem panic fixed. UQ_ASSUME_CM_OVER_DATA quirk removed because I've never seen a umodem that needed this rejection for proection (this gets rid of ~20% of the quirks). Approved by: re@ (kensmith) PR: 77940
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/ehci_pci.c10
-rw-r--r--sys/dev/usb/if_rum.c1
-rw-r--r--sys/dev/usb/if_ural.c1
-rw-r--r--sys/dev/usb/ohci_pci.c8
-rw-r--r--sys/dev/usb/ubser.c2
-rw-r--r--sys/dev/usb/ucycom.c7
-rw-r--r--sys/dev/usb/udbp.c1
-rw-r--r--sys/dev/usb/ufm.c1
-rw-r--r--sys/dev/usb/ufoma.c6
-rw-r--r--sys/dev/usb/uhci_pci.c11
-rw-r--r--sys/dev/usb/uhid.c1
-rw-r--r--sys/dev/usb/uhub.c60
-rw-r--r--sys/dev/usb/uipaq.c2
-rw-r--r--sys/dev/usb/ukbd.c10
-rw-r--r--sys/dev/usb/ulpt.c1
-rw-r--r--sys/dev/usb/umass.c39
-rw-r--r--sys/dev/usb/umodem.c19
-rw-r--r--sys/dev/usb/ums.c60
-rw-r--r--sys/dev/usb/urio.c203
-rw-r--r--sys/dev/usb/usb_quirks.c35
-rw-r--r--sys/dev/usb/usb_quirks.h3
-rw-r--r--sys/dev/usb/uscanner.c44
22 files changed, 203 insertions, 322 deletions
diff --git a/sys/dev/usb/ehci_pci.c b/sys/dev/usb/ehci_pci.c
index d9ba93f..2ff396e 100644
--- a/sys/dev/usb/ehci_pci.c
+++ b/sys/dev/usb/ehci_pci.c
@@ -153,11 +153,11 @@ extern int ehcidebug;
#define DPRINTF(x)
#endif
-static int ehci_pci_attach(device_t self);
-static int ehci_pci_detach(device_t self);
-static int ehci_pci_shutdown(device_t self);
-static int ehci_pci_suspend(device_t self);
-static int ehci_pci_resume(device_t self);
+static device_attach_t ehci_pci_attach;
+static device_detach_t ehci_pci_detach;
+static device_shutdown_t ehci_pci_shutdown;
+static device_suspend_t ehci_pci_suspend;
+static device_resume_t ehci_pci_resume;
static void ehci_pci_givecontroller(device_t self);
static void ehci_pci_takecontroller(device_t self);
diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c
index bef55ff..ca80573 100644
--- a/sys/dev/usb/if_rum.c
+++ b/sys/dev/usb/if_rum.c
@@ -123,6 +123,7 @@ static const struct usb_devno rum_devs[] = {
MODULE_DEPEND(rum, wlan, 1, 1, 1);
MODULE_DEPEND(rum, wlan_amrr, 1, 1, 1);
+MODULE_DEPEND(rum, usb, 1, 1, 1);
static int rum_alloc_tx_list(struct rum_softc *);
static void rum_free_tx_list(struct rum_softc *);
diff --git a/sys/dev/usb/if_ural.c b/sys/dev/usb/if_ural.c
index 78a91df..b70b358 100644
--- a/sys/dev/usb/if_ural.c
+++ b/sys/dev/usb/if_ural.c
@@ -112,6 +112,7 @@ static const struct usb_devno ural_devs[] = {
MODULE_DEPEND(ural, wlan, 1, 1, 1);
MODULE_DEPEND(ural, wlan_amrr, 1, 1, 1);
+MODULE_DEPEND(ural, usb, 1, 1, 1);
static int ural_alloc_tx_list(struct ural_softc *);
static void ural_free_tx_list(struct ural_softc *);
diff --git a/sys/dev/usb/ohci_pci.c b/sys/dev/usb/ohci_pci.c
index 914342d..05d4cb9 100644
--- a/sys/dev/usb/ohci_pci.c
+++ b/sys/dev/usb/ohci_pci.c
@@ -128,10 +128,10 @@ static const char *ohci_device_generic = "OHCI (generic) USB controller";
#define PCI_OHCI_BASE_REG 0x10
-static int ohci_pci_attach(device_t self);
-static int ohci_pci_detach(device_t self);
-static int ohci_pci_suspend(device_t self);
-static int ohci_pci_resume(device_t self);
+static device_attach_t ohci_pci_attach;
+static device_detach_t ohci_pci_detach;
+static device_suspend_t ohci_pci_suspend;
+static device_resume_t ohci_pci_resume;
static int
ohci_pci_suspend(device_t self)
diff --git a/sys/dev/usb/ubser.c b/sys/dev/usb/ubser.c
index b113c60..549be0b 100644
--- a/sys/dev/usb/ubser.c
+++ b/sys/dev/usb/ubser.c
@@ -885,5 +885,5 @@ ubsermodem(struct tty *tp, int sigon, int sigoff)
return (SER_DTR | SER_RTS | SER_DCD);
}
+MODULE_DEPEND(ubser, usb, 1, 1, 1);
DRIVER_MODULE(ubser, uhub, ubser_driver, ubser_devclass, usbd_driver_load, 0);
-
diff --git a/sys/dev/usb/ucycom.c b/sys/dev/usb/ucycom.c
index b5623f6..ecf115f 100644
--- a/sys/dev/usb/ucycom.c
+++ b/sys/dev/usb/ucycom.c
@@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$");
#include "usbdevs.h"
#include <dev/usb/usb.h>
-#include <dev/usb/usb_port.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
#include <dev/usb/usbhid.h>
@@ -103,9 +102,9 @@ struct ucycom_softc {
char sc_dying;
};
-static int ucycom_probe(device_t);
-static int ucycom_attach(device_t);
-static int ucycom_detach(device_t);
+static device_probe_t ucycom_probe;
+static device_attach_t ucycom_attach;
+static device_detach_t ucycom_detach;
static t_open_t ucycom_open;
static t_close_t ucycom_close;
static void ucycom_start(struct tty *);
diff --git a/sys/dev/usb/udbp.c b/sys/dev/usb/udbp.c
index 5726e7b..767618f 100644
--- a/sys/dev/usb/udbp.c
+++ b/sys/dev/usb/udbp.c
@@ -623,6 +623,7 @@ udbp_out_transfer_cb(usbd_xfer_handle xfer, usbd_private_handle priv,
DRIVER_MODULE(udbp, uhub, udbp_driver, udbp_devclass, usbd_driver_load, 0);
MODULE_DEPEND(udbp, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION);
+MODULE_DEPEND(udbp, usb, 1, 1, 1);
/***********************************************************************
diff --git a/sys/dev/usb/ufm.c b/sys/dev/usb/ufm.c
index f5bd932..9eaf49720 100644
--- a/sys/dev/usb/ufm.c
+++ b/sys/dev/usb/ufm.c
@@ -372,4 +372,5 @@ ufm_detach(device_t self)
return 0;
}
+MODULE_DEPEND(ufm, usb, 1, 1, 1);
DRIVER_MODULE(ufm, uhub, ufm_driver, ufm_devclass, usbd_driver_load, 0);
diff --git a/sys/dev/usb/ufoma.c b/sys/dev/usb/ufoma.c
index 7c2d668..8e93e25 100644
--- a/sys/dev/usb/ufoma.c
+++ b/sys/dev/usb/ufoma.c
@@ -184,9 +184,9 @@ struct ufoma_softc{
};
static usbd_status
ufoma_set_line_coding(struct ufoma_softc *sc, usb_cdc_line_state_t *state);
-static int ufoma_match(device_t);
-static int ufoma_attach(device_t);
-static int ufoma_detach(device_t);
+static device_probe_t ufoma_match;
+static device_attach_t ufoma_attach;
+static device_detach_t ufoma_detach;
static void *ufoma_get_intconf(usb_config_descriptor_t *cd, usb_interface_descriptor_t *id,int type, int subtype);
static void ufoma_notify(void * ,int count);
static void ufoma_intr(usbd_xfer_handle, usbd_private_handle, usbd_status);
diff --git a/sys/dev/usb/uhci_pci.c b/sys/dev/usb/uhci_pci.c
index dd4af7f..6c880a5 100644
--- a/sys/dev/usb/uhci_pci.c
+++ b/sys/dev/usb/uhci_pci.c
@@ -58,13 +58,11 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <sys/bus.h>
#include <sys/queue.h>
-#if defined(__FreeBSD__)
#include <sys/bus.h>
#include <machine/bus.h>
#include <machine/resource.h>
#include <sys/rman.h>
-#endif
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
@@ -155,11 +153,10 @@ static const char *uhci_device_generic = "UHCI (generic) USB controller";
#define PCI_UHCI_BASE_REG 0x20
-static int uhci_pci_attach(device_t self);
-static int uhci_pci_detach(device_t self);
-static int uhci_pci_suspend(device_t self);
-static int uhci_pci_resume(device_t self);
-
+static device_attach_t uhci_pci_attach;
+static device_detach_t uhci_pci_detach;
+static device_suspend_t uhci_pci_suspend;
+static device_resume_t uhci_pci_resume;
static int
uhci_pci_suspend(device_t self)
diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c
index 0510724..2a33cb3 100644
--- a/sys/dev/usb/uhid.c
+++ b/sys/dev/usb/uhid.c
@@ -169,7 +169,6 @@ static int uhid_do_ioctl(struct uhid_softc *, u_long, caddr_t, int,
struct thread *);
MODULE_DEPEND(uhid, usb, 1, 1, 1);
-MODULE_DEPEND(uhid, ether, 1, 1, 1);
static device_probe_t uhid_match;
static device_attach_t uhid_attach;
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c
index f8bdddb..aac0bfe 100644
--- a/sys/dev/usb/uhub.c
+++ b/sys/dev/usb/uhub.c
@@ -56,7 +56,6 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
-#include <dev/usb/usb_port.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
@@ -94,40 +93,58 @@ struct uhub_softc {
static usbd_status uhub_explore(usbd_device_handle hub);
static void uhub_intr(usbd_xfer_handle, usbd_private_handle,usbd_status);
-static bus_child_location_str_t uhub_child_location_str;
-static bus_child_pnpinfo_str_t uhub_child_pnpinfo_str;
-
/*
* We need two attachment points:
* hub to usb and hub to hub
* Every other driver only connects to hubs
*/
-/* XXX driver_added needs special care */
-USB_DECLARE_DRIVER_INIT(uhub,
+static device_probe_t uhub_match;
+static device_attach_t uhub_attach;
+static device_detach_t uhub_detach;
+static bus_child_location_str_t uhub_child_location_str;
+static bus_child_pnpinfo_str_t uhub_child_pnpinfo_str;
+
+static device_method_t uhub_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, uhub_match),
+ DEVMETHOD(device_attach, uhub_attach),
+ DEVMETHOD(device_detach, uhub_detach),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+
DEVMETHOD(bus_child_pnpinfo_str, uhub_child_pnpinfo_str),
DEVMETHOD(bus_child_location_str, uhub_child_location_str),
- DEVMETHOD(bus_driver_added, bus_generic_driver_added),
- DEVMETHOD(device_suspend, bus_generic_suspend),
- DEVMETHOD(device_resume, bus_generic_resume),
- DEVMETHOD(device_shutdown, bus_generic_shutdown)
- );
+ /* XXX driver_added needs special care */
+ DEVMETHOD(bus_driver_added, bus_generic_driver_added),
+ { 0, 0 }
+};
+
+static driver_t uhub_driver = {
+ "uhub",
+ uhub_methods,
+ sizeof(struct uhub_softc)
+};
+
+static devclass_t uhub_devclass;
/* Create the driver instance for the hub connected to usb case. */
devclass_t uhubroot_devclass;
-/* XXX driver_added needs special care */
static device_method_t uhubroot_methods[] = {
+ DEVMETHOD(device_probe, uhub_match),
+ DEVMETHOD(device_attach, uhub_attach),
+ DEVMETHOD(device_detach, uhub_detach),
+ DEVMETHOD(device_suspend, bus_generic_suspend),
+ DEVMETHOD(device_resume, bus_generic_resume),
+ DEVMETHOD(device_shutdown, bus_generic_shutdown),
+
DEVMETHOD(bus_child_location_str, uhub_child_location_str),
DEVMETHOD(bus_child_pnpinfo_str, uhub_child_pnpinfo_str),
- DEVMETHOD(bus_driver_added, bus_generic_driver_added),
-
- DEVMETHOD(device_probe, uhub_match),
- DEVMETHOD(device_attach, uhub_attach),
- DEVMETHOD(device_detach, uhub_detach),
- DEVMETHOD(device_suspend, bus_generic_suspend),
- DEVMETHOD(device_resume, bus_generic_resume),
- DEVMETHOD(device_shutdown, bus_generic_shutdown),
+ /* XXX driver_added needs special care */
+ DEVMETHOD(bus_driver_added, bus_generic_driver_added),
+
{0,0}
};
@@ -539,7 +556,7 @@ uhub_explore(usbd_device_handle dev)
static int
uhub_detach(device_t self)
{
- USB_DETACH_START(uhub, sc);
+ struct uhub_softc *sc = device_get_softc(self);
struct usbd_hub *hub = sc->sc_hub->hub;
struct usbd_port *rup;
int port, nports;
@@ -680,5 +697,6 @@ uhub_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status)
usb_needs_explore(sc->sc_hub);
}
+MODULE_DEPEND(uhub, usb, 1, 1, 1);
DRIVER_MODULE(uhub, usb, uhubroot_driver, uhubroot_devclass, 0, 0);
DRIVER_MODULE(uhub, uhub, uhub_driver, uhub_devclass, usbd_driver_load, 0);
diff --git a/sys/dev/usb/uipaq.c b/sys/dev/usb/uipaq.c
index 0128c1c..49fc14e 100644
--- a/sys/dev/usb/uipaq.c
+++ b/sys/dev/usb/uipaq.c
@@ -356,4 +356,4 @@ static driver_t uipaq_driver = {
DRIVER_MODULE(uipaq, uhub, uipaq_driver, ucom_devclass, usbd_driver_load, 0);
MODULE_DEPEND(uipaq, usb, 1, 1, 1);
-MODULE_DEPEND(uipaq, ucom,UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER);
+MODULE_DEPEND(uipaq, ucom, UCOM_MINVER, UCOM_PREFVER, UCOM_MAXVER);
diff --git a/sys/dev/usb/ukbd.c b/sys/dev/usb/ukbd.c
index daeb25a..7c3fd1a 100644
--- a/sys/dev/usb/ukbd.c
+++ b/sys/dev/usb/ukbd.c
@@ -144,6 +144,7 @@ static driver_t ukbd_driver = {
static devclass_t ukbd_devclass;
+MODULE_DEPEND(ukbd, usb, 1, 1, 1);
DRIVER_MODULE(ukbd, uhub, ukbd_driver, ukbd_devclass, usbd_driver_load, 0);
static int
@@ -1413,7 +1414,6 @@ static int
init_keyboard(ukbd_state_t *state, int *type, int flags)
{
usb_endpoint_descriptor_t *ed;
- usbd_status err;
*type = KB_OTHER;
@@ -1439,14 +1439,6 @@ bLength=%d bDescriptorType=%d bEndpointAddress=%d-%s bmAttributes=%d wMaxPacketS
return EINVAL;
}
- if ((usbd_get_quirks(state->ks_uaa->device)->uq_flags & UQ_NO_SET_PROTO) == 0) {
- err = usbd_set_protocol(state->ks_iface, 0);
- DPRINTFN(5, ("ukbd:init_keyboard: protocol set\n"));
- if (err) {
- printf("ukbd: set protocol failed\n");
- return EIO;
- }
- }
/* Ignore if SETIDLE fails since it is not crucial. */
usbd_set_idle(state->ks_iface, 0, 0);
diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c
index 321da2e..909aa28 100644
--- a/sys/dev/usb/ulpt.c
+++ b/sys/dev/usb/ulpt.c
@@ -187,6 +187,7 @@ static driver_t ulpt_driver = {
static devclass_t ulpt_devclass;
+MODULE_DEPEND(umass, usb, 1, 1, 1);
DRIVER_MODULE(ulpt, uhub, ulpt_driver, ulpt_devclass, usbd_driver_load, 0);
static int
diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c
index b928349..c42a0f2 100644
--- a/sys/dev/usb/umass.c
+++ b/sys/dev/usb/umass.c
@@ -115,7 +115,6 @@
#include <sys/bus.h>
#include <sys/sysctl.h>
-#include <dev/usb/usb_port.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
@@ -645,7 +644,7 @@ struct umass_softc {
unsigned char cam_scsi_command2[CAM_MAX_CDBLEN];
struct scsi_sense cam_scsi_sense;
struct scsi_sense cam_scsi_test_unit_ready;
- usb_callout_t cam_scsi_rescan_ch;
+ struct callout cam_scsi_rescan_ch;
int timeout; /* in msecs */
@@ -685,7 +684,27 @@ static uint8_t fake_inq_data[SHORT_INQUIRY_LENGTH] = {
};
/* USB device probe/attach/detach functions */
-USB_DECLARE_DRIVER(umass);
+static device_probe_t umass_match;
+static device_attach_t umass_attach;
+static device_detach_t umass_detach;
+
+static device_method_t umass_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, umass_match),
+ DEVMETHOD(device_attach, umass_attach),
+ DEVMETHOD(device_detach, umass_detach),
+
+ { 0, 0 }
+};
+
+static driver_t umass_driver = {
+ "umass",
+ umass_methods,
+ sizeof(struct umass_softc)
+};
+
+static devclass_t umass_devclass;
+
static int umass_match_proto (struct umass_softc *sc,
usbd_interface_handle iface,
usbd_device_handle udev);
@@ -784,7 +803,8 @@ static void umass_dump_buffer (struct umass_softc *sc, u_int8_t *buffer,
int buflen, int printlen);
#endif
-MODULE_DEPEND(umass, cam, 1,1,1);
+MODULE_DEPEND(umass, cam, 1, 1, 1);
+MODULE_DEPEND(umass, usb, 1, 1, 1);
/*
* USB device probe/attach/detach
@@ -924,7 +944,8 @@ umass_match(device_t self)
static int
umass_attach(device_t self)
{
- USB_ATTACH_START(umass, sc, uaa);
+ struct umass_softc *sc = device_get_softc(self);
+ struct usb_attach_arg *uaa = device_get_ivars(self);
usb_interface_descriptor_t *id;
usb_endpoint_descriptor_t *ed;
int i;
@@ -937,7 +958,7 @@ umass_attach(device_t self)
sc->sc_dev = self;
sc->iface = uaa->iface;
sc->ifaceno = uaa->ifaceno;
- usb_callout_init(sc->cam_scsi_rescan_ch);
+ callout_init(&sc->cam_scsi_rescan_ch, 0);
/* initialise the proto and drive values in the umass_softc (again) */
(void) umass_match_proto(sc, sc->iface, uaa->device);
@@ -1179,7 +1200,7 @@ umass_attach(device_t self)
static int
umass_detach(device_t self)
{
- USB_DETACH_START(umass, sc);
+ struct umass_softc *sc = device_get_softc(self);
int err = 0;
int i;
@@ -1196,7 +1217,7 @@ umass_detach(device_t self)
if (sc->intrin_pipe)
usbd_abort_pipe(sc->intrin_pipe);
- usb_uncallout_drain(sc->cam_scsi_rescan_ch, umass_cam_rescan, sc);
+ callout_drain(&sc->cam_scsi_rescan_ch);
if ((sc->proto & UMASS_PROTO_SCSI) ||
(sc->proto & UMASS_PROTO_ATAPI) ||
(sc->proto & UMASS_PROTO_UFI) ||
@@ -2339,7 +2360,7 @@ umass_cam_attach(struct umass_softc *sc)
* completed, when interrupts have been enabled.
*/
- usb_callout(sc->cam_scsi_rescan_ch, MS_TO_TICKS(200),
+ callout_reset(&sc->cam_scsi_rescan_ch, MS_TO_TICKS(200),
umass_cam_rescan, sc);
}
diff --git a/sys/dev/usb/umodem.c b/sys/dev/usb/umodem.c
index 50a0f62..64df43a 100644
--- a/sys/dev/usb/umodem.c
+++ b/sys/dev/usb/umodem.c
@@ -284,9 +284,6 @@ umodem_attach(device_t self)
int i;
struct ucom_softc *ucom;
- id = usbd_get_interface_descriptor(sc->sc_ctl_iface);
- device_printf(self, "iclass %d/%d", id->bInterfaceClass,
- id->bInterfaceSubClass);
ucom = &sc->sc_ucom;
ucom->sc_dev = self;
sc->sc_dev = self;
@@ -296,6 +293,9 @@ umodem_attach(device_t self)
sc->sc_udev = dev;
sc->sc_ctl_iface = uaa->iface;
sc->sc_ctl_iface_no = id->bInterfaceNumber;
+ id = usbd_get_interface_descriptor(sc->sc_ctl_iface);
+ device_printf(self, "iclass %d/%d", id->bInterfaceClass,
+ id->bInterfaceSubClass);
umodem_get_caps(dev, &sc->sc_cm_cap, &sc->sc_acm_cap);
@@ -360,16 +360,11 @@ umodem_attach(device_t self)
goto bad;
}
- if (usbd_get_quirks(sc->sc_udev)->uq_flags & UQ_ASSUME_CM_OVER_DATA) {
- DPRINTF(("Quirk says to assume CM over data\n"));
+ if (sc->sc_cm_cap & USB_CDC_CM_OVER_DATA) {
+ if (sc->sc_acm_cap & USB_CDC_ACM_HAS_FEATURE)
+ umodem_set_comm_feature(sc, UCDC_ABSTRACT_STATE,
+ UCDC_DATA_MULTIPLEXED);
sc->sc_cm_over_data = 1;
- } else {
- if (sc->sc_cm_cap & USB_CDC_CM_OVER_DATA) {
- if (sc->sc_acm_cap & USB_CDC_ACM_HAS_FEATURE)
- umodem_set_comm_feature(sc,
- UCDC_ABSTRACT_STATE, UCDC_DATA_MULTIPLEXED);
- sc->sc_cm_over_data = 1;
- }
}
/*
diff --git a/sys/dev/usb/ums.c b/sys/dev/usb/ums.c
index c0d2d98..e954154 100644
--- a/sys/dev/usb/ums.c
+++ b/sys/dev/usb/ums.c
@@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/uio.h>
-#include <dev/usb/usb_port.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbhid.h>
@@ -100,7 +99,7 @@ struct ums_softc {
struct hid_location sc_loc_x, sc_loc_y, sc_loc_z, sc_loc_t;
struct hid_location *sc_loc_btn;
- usb_callout_t callout_handle; /* for spurious button ups */
+ struct callout callout_handle; /* for spurious button ups */
int sc_enabled;
int sc_disconnected; /* device is gone */
@@ -158,7 +157,26 @@ static struct cdevsw ums_cdevsw = {
.d_name = "ums",
};
-USB_DECLARE_DRIVER(ums);
+static device_probe_t ums_match;
+static device_attach_t ums_attach;
+static device_detach_t ums_detach;
+
+static device_method_t ums_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, ums_match),
+ DEVMETHOD(device_attach, ums_attach),
+ DEVMETHOD(device_detach, ums_detach),
+
+ { 0, 0 }
+};
+
+static driver_t ums_driver = {
+ "ums",
+ ums_methods,
+ sizeof(struct ums_softc)
+};
+
+static devclass_t ums_devclass;
static int
ums_match(device_t self)
@@ -192,7 +210,8 @@ ums_match(device_t self)
static int
ums_attach(device_t self)
{
- USB_ATTACH_START(ums, sc, uaa);
+ struct ums_softc *sc = device_get_softc(self);
+ struct usb_attach_arg *uaa = device_get_ivars(self);
usbd_interface_handle iface = uaa->iface;
usb_interface_descriptor_t *id;
usb_endpoint_descriptor_t *ed;
@@ -355,7 +374,7 @@ ums_attach(device_t self)
UID_ROOT, GID_OPERATOR,
0644, "ums%d", device_get_unit(self));
- usb_callout_init(sc->callout_handle);
+ callout_init(&sc->callout_handle, 0);
if (usbd_get_quirks(uaa->device)->uq_flags & UQ_SPUR_BUT_UP) {
DPRINTF(("%s: Spurious button up events\n",
device_get_nameunit(sc->sc_dev)));
@@ -402,10 +421,7 @@ ums_detach(device_t self)
}
void
-ums_intr(xfer, addr, status)
- usbd_xfer_handle xfer;
- usbd_private_handle addr;
- usbd_status status;
+ums_intr(usbd_xfer_handle xfer, usbd_private_handle addr, usbd_status status)
{
struct ums_softc *sc = addr;
u_char *ibuf;
@@ -494,11 +510,10 @@ ums_intr(xfer, addr, status)
*/
if (sc->flags & UMS_SPUR_BUT_UP &&
dx == 0 && dy == 0 && dz == 0 && dt == 0 && buttons == 0) {
- usb_callout(sc->callout_handle, MS_TO_TICKS(50 /*msecs*/),
- ums_add_to_queue_timeout, (void *) sc);
+ callout_reset(&sc->callout_handle, MS_TO_TICKS(50),
+ ums_add_to_queue_timeout, (void *) sc);
} else {
- usb_uncallout(sc->callout_handle,
- ums_add_to_queue_timeout, (void *) sc);
+ callout_stop(&sc->callout_handle);
ums_add_to_queue(sc, dx, dy, dz, dt, buttons);
}
}
@@ -603,7 +618,7 @@ ums_disable(priv)
{
struct ums_softc *sc = priv;
- usb_uncallout(sc->callout_handle, ums_add_to_queue_timeout, sc);
+ callout_stop(&sc->callout_handle);
/* Disable interrupts. */
usbd_abort_pipe(sc->sc_intrpipe);
@@ -620,7 +635,9 @@ ums_open(struct cdev *dev, int flag, int fmt, struct thread *p)
{
struct ums_softc *sc;
- USB_GET_SC_OPEN(ums, UMSUNIT(dev), sc);
+ sc = devclass_get_softc(ums_devclass, UMSUNIT(dev));
+ if (sc == NULL)
+ return (ENXIO);
return ums_enable(sc);
}
@@ -630,8 +647,7 @@ ums_close(struct cdev *dev, int flag, int fmt, struct thread *p)
{
struct ums_softc *sc;
- USB_GET_SC(ums, UMSUNIT(dev), sc);
-
+ sc = devclass_get_softc(ums_devclass, UMSUNIT(dev));
if (!sc)
return 0;
@@ -650,8 +666,7 @@ ums_read(struct cdev *dev, struct uio *uio, int flag)
int l = 0;
int error;
- USB_GET_SC(ums, UMSUNIT(dev), sc);
-
+ sc = devclass_get_softc(ums_devclass, UMSUNIT(dev));
s = splusb();
if (!sc) {
splx(s);
@@ -718,8 +733,7 @@ ums_poll(struct cdev *dev, int events, struct thread *p)
int revents = 0;
int s;
- USB_GET_SC(ums, UMSUNIT(dev), sc);
-
+ sc = devclass_get_softc(ums_devclass, UMSUNIT(dev));
if (!sc)
return 0;
@@ -745,8 +759,7 @@ ums_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *p
int s;
mousemode_t mode;
- USB_GET_SC(ums, UMSUNIT(dev), sc);
-
+ sc = devclass_get_softc(ums_devclass, UMSUNIT(dev));
if (!sc)
return EIO;
@@ -853,4 +866,5 @@ ums_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *p
return error;
}
+MODULE_DEPEND(ums, usb, 1, 1, 1);
DRIVER_MODULE(ums, uhub, ums_driver, ums_devclass, usbd_driver_load, 0);
diff --git a/sys/dev/usb/urio.c b/sys/dev/usb/urio.c
index c8f82cf..01e276a 100644
--- a/sys/dev/usb/urio.c
+++ b/sys/dev/usb/urio.c
@@ -62,7 +62,6 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/uio.h>
-#include <dev/usb/usb_port.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
@@ -124,16 +123,33 @@ struct urio_softc {
int sc_refcnt;
struct cdev *sc_dev_t;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
u_char sc_dying;
-#endif
};
#define URIOUNIT(n) (minor(n))
#define RIO_RW_TIMEOUT 4000 /* ms */
-USB_DECLARE_DRIVER(urio);
+static device_probe_t urio_match;
+static device_attach_t urio_attach;
+static device_detach_t urio_detach;
+
+static device_method_t urio_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, urio_match),
+ DEVMETHOD(device_attach, urio_attach),
+ DEVMETHOD(device_detach, urio_detach),
+
+ { 0, 0 }
+};
+
+static driver_t urio_driver = {
+ "urio",
+ urio_methods,
+ sizeof(struct urio_softc)
+};
+
+static devclass_t urio_devclass;
static int
urio_match(device_t self)
@@ -161,13 +177,11 @@ urio_match(device_t self)
static int
urio_attach(device_t self)
{
- USB_ATTACH_START(urio, sc, uaa);
+ struct urio_softc *sc = device_get_softc(self);
+ struct usb_attach_arg *uaa = device_get_ivars(self);
usbd_device_handle udev;
usbd_interface_handle iface;
u_int8_t epcount;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- u_int8_t niface;
-#endif
usbd_status r;
char * ermsg = "<none>";
int i;
@@ -176,29 +190,11 @@ urio_attach(device_t self)
sc->sc_dev = self;
sc->sc_udev = udev = uaa->device;
-#if defined(__FreeBSD__)
if ((!uaa->device) || (!uaa->iface)) {
ermsg = "device or iface";
goto nobulk;
}
sc->sc_iface = iface = uaa->iface;
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
- if (!udev) {
- ermsg = "device";
- goto nobulk;
- }
- r = usbd_interface_count(udev, &niface);
- if (r) {
- ermsg = "iface";
- goto nobulk;
- }
- r = usbd_device2interface_handle(udev, 0, &iface);
- if (r) {
- ermsg = "iface";
- goto nobulk;
- }
- sc->sc_iface = iface;
-#endif
sc->sc_opened = 0;
sc->sc_pipeh_in = 0;
sc->sc_pipeh_out = 0;
@@ -233,15 +229,9 @@ urio_attach(device_t self)
goto nobulk;
}
-#if defined(__FreeBSD__)
- /* XXX no error trapping, no storing of struct cdev **/
sc->sc_dev_t = make_dev(&urio_cdevsw, device_get_unit(self),
UID_ROOT, GID_OPERATOR,
0644, "urio%d", device_get_unit(self));
-#elif defined(__NetBSD__) || defined(__OpenBSD__)
- usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, sc->sc_dev);
-#endif
-
DPRINTFN(10, ("urio_attach: %p\n", sc->sc_udev));
return 0;
@@ -255,11 +245,11 @@ urio_attach(device_t self)
int
urioopen(struct cdev *dev, int flag, int mode, struct thread *p)
{
-#if (USBDI >= 1)
struct urio_softc * sc;
-#endif
int unit = URIOUNIT(dev);
- USB_GET_SC_OPEN(urio, unit, sc);
+ sc = devclass_get_softc(urio_devclass, unit);
+ if (sc == NULL)
+ return (ENXIO);
DPRINTFN(5, ("urioopen: flag=%d, mode=%d, unit=%d\n",
flag, mode, unit));
@@ -295,11 +285,9 @@ urioopen(struct cdev *dev, int flag, int mode, struct thread *p)
int
urioclose(struct cdev *dev, int flag, int mode, struct thread *p)
{
-#if (USBDI >= 1)
struct urio_softc * sc;
-#endif
int unit = URIOUNIT(dev);
- USB_GET_SC(urio, unit, sc);
+ sc = devclass_get_softc(urio_devclass, unit);
DPRINTFN(5, ("urioclose: flag=%d, mode=%d, unit=%d\n", flag, mode, unit));
if (sc->sc_pipeh_in)
@@ -318,49 +306,29 @@ urioclose(struct cdev *dev, int flag, int mode, struct thread *p)
int
urioread(struct cdev *dev, struct uio *uio, int flag)
{
-#if (USBDI >= 1)
struct urio_softc * sc;
usbd_xfer_handle reqh;
-#else
- usbd_request_handle reqh;
- usbd_private_handle r_priv;
- void *r_buff;
- usbd_status r_status;
-#endif
int unit = URIOUNIT(dev);
usbd_status r;
char buf[URIO_BBSIZE];
u_int32_t n, tn;
int error = 0;
- USB_GET_SC(urio, unit, sc);
+ sc = devclass_get_softc(urio_devclass, unit);
DPRINTFN(5, ("urioread: %d\n", unit));
if (!sc->sc_opened)
return EIO;
-#if (USBDI >= 1)
sc->sc_refcnt++;
reqh = usbd_alloc_xfer(sc->sc_udev);
-#else
- reqh = usbd_alloc_request();
-#endif
if (reqh == 0)
return ENOMEM;
while ((n = min(URIO_BBSIZE, uio->uio_resid)) != 0) {
DPRINTFN(1, ("urioread: start transfer %d bytes\n", n));
tn = n;
-#if (USBDI >= 1)
usbd_setup_xfer(reqh, sc->sc_pipeh_in, 0, buf, tn,
0, RIO_RW_TIMEOUT, 0);
-#else
- r = usbd_setup_request(reqh, sc->sc_pipeh_in, 0, buf, tn,
- 0, RIO_RW_TIMEOUT, 0);
- if (r != USBD_NORMAL_COMPLETION) {
- error = EIO;
- break;
- }
-#endif
r = usbd_sync_transfer(reqh);
if (r != USBD_NORMAL_COMPLETION) {
DPRINTFN(1, ("urioread: error=%d\n", r));
@@ -369,53 +337,35 @@ urioread(struct cdev *dev, struct uio *uio, int flag)
error = EIO;
break;
}
-#if (USBDI >= 1)
usbd_get_xfer_status(reqh, 0, 0, &tn, 0);
-#else
- usbd_get_request_status(reqh, &r_priv, &r_buff, &tn, &r_status);
-#endif
DPRINTFN(1, ("urioread: got %d bytes\n", tn));
error = uiomove(buf, tn, uio);
if (error || tn < n)
break;
}
-#if (USBDI >= 1)
usbd_free_xfer(reqh);
-#else
- usbd_free_request(reqh);
-#endif
-
return error;
}
int
uriowrite(struct cdev *dev, struct uio *uio, int flag)
{
-#if (USBDI >= 1)
struct urio_softc * sc;
usbd_xfer_handle reqh;
-#else
- usbd_request_handle reqh;
-#endif
int unit = URIOUNIT(dev);
usbd_status r;
char buf[URIO_BBSIZE];
u_int32_t n;
int error = 0;
- USB_GET_SC(urio, unit, sc);
-
+ sc = devclass_get_softc(urio_devclass, unit);
DPRINTFN(5, ("uriowrite: %d\n", unit));
if (!sc->sc_opened)
return EIO;
-#if (USBDI >= 1)
sc->sc_refcnt++;
reqh = usbd_alloc_xfer(sc->sc_udev);
-#else
- reqh = usbd_alloc_request();
-#endif
if (reqh == 0)
return EIO;
while ((n = min(URIO_BBSIZE, uio->uio_resid)) != 0) {
@@ -423,17 +373,8 @@ uriowrite(struct cdev *dev, struct uio *uio, int flag)
if (error)
break;
DPRINTFN(1, ("uriowrite: transfer %d bytes\n", n));
-#if (USBDI >= 1)
usbd_setup_xfer(reqh, sc->sc_pipeh_out, 0, buf, n,
0, RIO_RW_TIMEOUT, 0);
-#else
- r = usbd_setup_request(reqh, sc->sc_pipeh_out, 0, buf, n,
- 0, RIO_RW_TIMEOUT, 0);
- if (r != USBD_NORMAL_COMPLETION) {
- error = EIO;
- break;
- }
-#endif
r = usbd_sync_transfer(reqh);
if (r != USBD_NORMAL_COMPLETION) {
DPRINTFN(1, ("uriowrite: error=%d\n", r));
@@ -441,17 +382,10 @@ uriowrite(struct cdev *dev, struct uio *uio, int flag)
error = EIO;
break;
}
-#if (USBDI >= 1)
usbd_get_xfer_status(reqh, 0, 0, 0, 0);
-#endif
}
-#if (USBDI >= 1)
usbd_free_xfer(reqh);
-#else
- usbd_free_request(reqh);
-#endif
-
return error;
}
@@ -459,9 +393,7 @@ uriowrite(struct cdev *dev, struct uio *uio, int flag)
int
urioioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *p)
{
-#if (USBDI >= 1)
struct urio_softc * sc;
-#endif
int unit = URIOUNIT(dev);
struct RioCommand *rio_cmd;
int requesttype, len;
@@ -473,8 +405,7 @@ urioioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *p
int error = 0;
usbd_status r;
- USB_GET_SC(urio, unit, sc);
-
+ sc = devclass_get_softc(urio_devclass, unit);
switch (cmd) {
case RIO_RECV_COMMAND:
if (!(flag & FWRITE))
@@ -556,61 +487,14 @@ ret:
return error;
}
-
-#if defined(__NetBSD__) || defined(__OpenBSD__)
-int
-urio_activate(device_t self, enum devact act)
-{
- struct urio_softc *sc = (struct urio_softc *)self;
-
- switch (act) {
- case DVACT_ACTIVATE:
- return (EOPNOTSUPP);
- break;
-
- case DVACT_DEACTIVATE:
- sc->sc_dying = 1;
- break;
- }
- return (0);
-}
-
static int
urio_detach(device_t self)
{
- USB_DETACH_START(urio, sc);
- struct urio_endpoint *sce;
- int i, dir;
+ struct urio_softc *sc = device_get_softc(self);
int s;
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- int maj, mn;
- DPRINTF(("urio_detach: sc=%p flags=%d\n", sc, flags));
-#elif defined(__FreeBSD__)
DPRINTF(("urio_detach: sc=%p\n", sc));
-#endif
-
sc->sc_dying = 1;
- /* Abort all pipes. Causes processes waiting for transfer to wake. */
-#if 0
- for (i = 0; i < USB_MAX_ENDPOINTS; i++) {
- for (dir = OUT; dir <= IN; dir++) {
- sce = &sc->sc_endpoints[i][dir];
- if (sce && sce->pipeh)
- usbd_abort_pipe(sce->pipeh);
- }
- }
-
- s = splusb();
- if (--sc->sc_refcnt >= 0) {
- /* Wake everyone */
- for (i = 0; i < USB_MAX_ENDPOINTS; i++)
- wakeup(&sc->sc_endpoints[i][IN]);
- /* Wait for processes to go away. */
- usb_detach_wait(sc->sc_dev);
- }
- splx(s);
-#else
if (sc->sc_pipeh_in)
usbd_abort_pipe(sc->sc_pipeh_in);
@@ -623,37 +507,12 @@ urio_detach(device_t self)
usb_detach_wait(sc->sc_dev);
}
splx(s);
-#endif
-
-#if defined(__NetBSD__) || defined(__OpenBSD__)
- /* locate the major number */
- for (maj = 0; maj < nchrdev; maj++)
- if (cdevsw[maj].d_open == urioopen)
- break;
- /* Nuke the vnodes for any open instances (calls close). */
- mn = self->dv_unit * USB_MAX_ENDPOINTS;
- vdevgone(maj, mn, mn + USB_MAX_ENDPOINTS - 1, VCHR);
-#endif
-
- usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, sc->sc_dev);
-
- return (0);
-}
-#endif /* defined(__NetBSD__) || defined(__OpenBSD__) */
-
-#if defined(__FreeBSD__)
-static int
-urio_detach(device_t self)
-{
- struct urio_softc *sc = device_get_softc(self);
-
- DPRINTF(("%s: disconnected\n", device_get_nameunit(self)));
destroy_dev(sc->sc_dev_t);
/* XXX not implemented yet */
device_set_desc(self, NULL);
return 0;
}
+MODULE_DEPEND(uscanner, usb, 1, 1, 1);
DRIVER_MODULE(urio, uhub, urio_driver, urio_devclass, usbd_driver_load, 0);
-#endif
diff --git a/sys/dev/usb/usb_quirks.c b/sys/dev/usb/usb_quirks.c
index 5a21c15..8e9967d 100644
--- a/sys/dev/usb/usb_quirks.c
+++ b/sys/dev/usb/usb_quirks.c
@@ -60,7 +60,6 @@ static const struct usbd_quirk_entry {
u_int16_t bcdDevice;
struct usbd_quirks quirks;
} usb_quirks[] = {
- { USB_VENDOR_KYE, USB_PRODUCT_KYE_NICHE, 0x100, { UQ_NO_SET_PROTO}},
{ USB_VENDOR_INSIDEOUT, USB_PRODUCT_INSIDEOUT_EDGEPORT4,
0x094, { UQ_SWAP_UNICODE}},
{ USB_VENDOR_DALLAS, USB_PRODUCT_DALLAS_J6502, 0x0a2, { UQ_BAD_ADC }},
@@ -71,27 +70,11 @@ static const struct usbd_quirk_entry {
{ USB_VENDOR_ALCOR2, USB_PRODUCT_ALCOR2_KBD_HUB, 0x001, { UQ_SPUR_BUT_UP }},
{ USB_VENDOR_MCT, USB_PRODUCT_MCT_HUB0100, 0x102, { UQ_BUS_POWERED }},
{ USB_VENDOR_MCT, USB_PRODUCT_MCT_USB232, 0x102, { UQ_BUS_POWERED }},
- { USB_VENDOR_METRICOM, USB_PRODUCT_METRICOM_RICOCHET_GS,
- 0x100, { UQ_ASSUME_CM_OVER_DATA }},
- { USB_VENDOR_SANYO, USB_PRODUCT_SANYO_SCP4900,
- 0x000, { UQ_ASSUME_CM_OVER_DATA }},
{ USB_VENDOR_TI, USB_PRODUCT_TI_UTUSB41, 0x110, { UQ_POWER_CLAIM }},
{ USB_VENDOR_TELEX, USB_PRODUCT_TELEX_MIC1, 0x009, { UQ_AU_NO_FRAC }},
{ USB_VENDOR_SILICONPORTALS, USB_PRODUCT_SILICONPORTALS_YAPPHONE,
0x100, { UQ_AU_INP_ASYNC }},
{ USB_VENDOR_LOGITECH, USB_PRODUCT_LOGITECH_UN53B, ANY, { UQ_NO_STRINGS }},
- { USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_CNU510,
- ANY, { UQ_ASSUME_CM_OVER_DATA }},
- { USB_VENDOR_CMOTECH, USB_PRODUCT_CMOTECH_CNU550,
- ANY, { UQ_ASSUME_CM_OVER_DATA }},
- { USB_VENDOR_CURITEL, USB_PRODUCT_CURITEL_HX550C,
- ANY, { UQ_ASSUME_CM_OVER_DATA }},
- { USB_VENDOR_CURITEL, USB_PRODUCT_CURITEL_HX57XB,
- ANY, { UQ_ASSUME_CM_OVER_DATA }},
- { USB_VENDOR_UBIQUAM, USB_PRODUCT_UBIQUAM_UALL,
- ANY, { UQ_ASSUME_CM_OVER_DATA }},
- { USB_VENDOR_QUALCOMM, USB_PRODUCT_QUALCOMM_RWT_FCT,
- ANY, { UQ_ASSUME_CM_OVER_DATA }},
/* XXX These should have a revision number, but I don't know what they are. */
{ USB_VENDOR_HP, USB_PRODUCT_HP_895C, ANY, { UQ_BROKEN_BIDIR }},
{ USB_VENDOR_HP, USB_PRODUCT_HP_880C, ANY, { UQ_BROKEN_BIDIR }},
@@ -100,23 +83,6 @@ static const struct usbd_quirk_entry {
{ USB_VENDOR_HP, USB_PRODUCT_HP_830C, ANY, { UQ_BROKEN_BIDIR }},
{ USB_VENDOR_HP, USB_PRODUCT_HP_1220C, ANY, { UQ_BROKEN_BIDIR }},
{ USB_VENDOR_XEROX, USB_PRODUCT_XEROX_WCM15, ANY, { UQ_BROKEN_BIDIR }},
- /* YAMAHA router's ucdDevice is the version of farmware and often changes. */
- { USB_VENDOR_YAMAHA, USB_PRODUCT_YAMAHA_RTA54I,
- ANY, { UQ_ASSUME_CM_OVER_DATA }},
- { USB_VENDOR_YAMAHA, USB_PRODUCT_YAMAHA_RTA55I,
- ANY, { UQ_ASSUME_CM_OVER_DATA }},
- { USB_VENDOR_YAMAHA, USB_PRODUCT_YAMAHA_RTW65B,
- ANY, { UQ_ASSUME_CM_OVER_DATA }},
- { USB_VENDOR_YAMAHA, USB_PRODUCT_YAMAHA_RTW65I,
- ANY, { UQ_ASSUME_CM_OVER_DATA }},
- { USB_VENDOR_QUALCOMM, USB_PRODUCT_QUALCOMM_CDMA_MSM,
- ANY, { UQ_ASSUME_CM_OVER_DATA }},
- { USB_VENDOR_QUALCOMM2, USB_PRODUCT_QUALCOMM2_CDMA_MSM,
- ANY, { UQ_ASSUME_CM_OVER_DATA }},
- { USB_VENDOR_SUNTAC, USB_PRODUCT_SUNTAC_AS64LX,
- 0x100, { UQ_ASSUME_CM_OVER_DATA }},
- { USB_VENDOR_MOTOROLA2, USB_PRODUCT_MOTOROLA2_A41XV32X,
- ANY, { UQ_ASSUME_CM_OVER_DATA }},
/* Devices which should be ignored by uhid */
{ USB_VENDOR_APC, USB_PRODUCT_APC_UPS,
ANY, { UQ_HID_IGNORE }},
@@ -130,6 +96,7 @@ static const struct usbd_quirk_entry {
ANY, { UQ_HID_IGNORE }},
{ USB_VENDOR_MGE, USB_PRODUCT_MGE_UPS2,
ANY, { UQ_HID_IGNORE }},
+
/* Devices which should be ignored by both ukbd and uhid */
{ USB_VENDOR_CYPRESS, USB_PRODUCT_CYPRESS_WISPY,
ANY, { UQ_KBD_IGNORE }},
diff --git a/sys/dev/usb/usb_quirks.h b/sys/dev/usb/usb_quirks.h
index cb140b9..d152bfb 100644
--- a/sys/dev/usb/usb_quirks.h
+++ b/sys/dev/usb/usb_quirks.h
@@ -40,7 +40,6 @@
struct usbd_quirks {
u_int32_t uq_flags; /* Device problems: */
-#define UQ_NO_SET_PROTO 0x0001 /* cannot handle SET PROTOCOL. */
#define UQ_SWAP_UNICODE 0x0002 /* has some Unicode strings swapped. */
#define UQ_MS_REVZ 0x0004 /* mouse has Z-axis reversed */
#define UQ_NO_STRINGS 0x0008 /* string descriptors are broken. */
@@ -52,12 +51,10 @@ struct usbd_quirks {
#define UQ_POWER_CLAIM 0x0200 /* hub lies about power status */
#define UQ_AU_NO_FRAC 0x0400 /* don't adjust for fractional samples */
#define UQ_AU_INP_ASYNC 0x0800 /* input is async despite claim of adaptive */
-#define UQ_ASSUME_CM_OVER_DATA 0x1000 /* modem device breaks on cm over data */
#define UQ_BROKEN_BIDIR 0x2000 /* printer has broken bidir mode */
#define UQ_OPEN_CLEARSTALL 0x4000 /* device needs clear endpoint stall */
#define UQ_HID_IGNORE 0x8000 /* device should be ignored by hid class */
#define UQ_KBD_IGNORE 0x18000 /* device should be ignored by both kbd and hid class */
-
};
extern const struct usbd_quirks usbd_no_quirk;
diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c
index 00462e0..60a79c9 100644
--- a/sys/dev/usb/uscanner.c
+++ b/sys/dev/usb/uscanner.c
@@ -64,7 +64,6 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/uio.h>
-#include <dev/usb/usb_port.h>
#include <dev/usb/usb.h>
#include <dev/usb/usbdi.h>
#include <dev/usb/usbdi_util.h>
@@ -289,7 +288,26 @@ static void uscanner_do_close(struct uscanner_softc *);
#define USCANNERUNIT(n) (minor(n))
-USB_DECLARE_DRIVER(uscanner);
+static device_probe_t uscanner_match;
+static device_attach_t uscanner_attach;
+static device_detach_t uscanner_detach;
+
+static device_method_t uscanner_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, uscanner_match),
+ DEVMETHOD(device_attach, uscanner_attach),
+ DEVMETHOD(device_detach, uscanner_detach),
+
+ { 0, 0 }
+};
+
+static driver_t uscanner_driver = {
+ "uscanner",
+ uscanner_methods,
+ sizeof(struct uscanner_softc)
+};
+
+static devclass_t uscanner_devclass;
static int
uscanner_match(device_t self)
@@ -306,7 +324,8 @@ uscanner_match(device_t self)
static int
uscanner_attach(device_t self)
{
- USB_ATTACH_START(uscanner, sc, uaa);
+ struct uscanner_softc *sc = device_get_softc(self);
+ struct usb_attach_arg *uaa = device_get_ivars(self);
usb_interface_descriptor_t *id = 0;
usb_endpoint_descriptor_t *ed, *ed_bulkin = NULL, *ed_bulkout = NULL;
int i;
@@ -379,7 +398,9 @@ uscanneropen(struct cdev *dev, int flag, int mode, struct thread *p)
int unit = USCANNERUNIT(dev);
usbd_status err;
- USB_GET_SC_OPEN(uscanner, unit, sc);
+ sc = devclass_get_softc(uscanner_devclass, unit);
+ if (sc == NULL)
+ return (ENXIO);
DPRINTFN(5, ("uscanneropen: flag=%d, mode=%d, unit=%d\n",
flag, mode, unit));
@@ -440,8 +461,7 @@ uscannerclose(struct cdev *dev, int flag, int mode, struct thread *p)
{
struct uscanner_softc *sc;
- USB_GET_SC(uscanner, USCANNERUNIT(dev), sc);
-
+ sc = devclass_get_softc(uscanner_devclass, USCANNERUNIT(dev));
DPRINTFN(5, ("uscannerclose: flag=%d, mode=%d, unit=%d\n",
flag, mode, USCANNERUNIT(dev)));
@@ -539,8 +559,7 @@ uscannerread(struct cdev *dev, struct uio *uio, int flag)
struct uscanner_softc *sc;
int error;
- USB_GET_SC(uscanner, USCANNERUNIT(dev), sc);
-
+ sc = devclass_get_softc(uscanner_devclass, USCANNERUNIT(dev));
sc->sc_refcnt++;
error = uscanner_do_read(sc, uio, flag);
if (--sc->sc_refcnt < 0)
@@ -589,8 +608,7 @@ uscannerwrite(struct cdev *dev, struct uio *uio, int flag)
struct uscanner_softc *sc;
int error;
- USB_GET_SC(uscanner, USCANNERUNIT(dev), sc);
-
+ sc = devclass_get_softc(uscanner_devclass, USCANNERUNIT(dev));
sc->sc_refcnt++;
error = uscanner_do_write(sc, uio, flag);
if (--sc->sc_refcnt < 0)
@@ -601,7 +619,7 @@ uscannerwrite(struct cdev *dev, struct uio *uio, int flag)
static int
uscanner_detach(device_t self)
{
- USB_DETACH_START(uscanner, sc);
+ struct uscanner_softc *sc = device_get_softc(self);
int s;
DPRINTF(("uscanner_detach: sc=%p\n", sc));
@@ -635,8 +653,7 @@ uscannerpoll(struct cdev *dev, int events, struct thread *p)
struct uscanner_softc *sc;
int revents = 0;
- USB_GET_SC(uscanner, USCANNERUNIT(dev), sc);
-
+ sc = devclass_get_softc(uscanner_devclass, USCANNERUNIT(dev));
if (sc->sc_dying)
return (EIO);
@@ -651,4 +668,5 @@ uscannerpoll(struct cdev *dev, int events, struct thread *p)
return (revents);
}
+MODULE_DEPEND(uscanner, usb, 1, 1, 1);
DRIVER_MODULE(uscanner, uhub, uscanner_driver, uscanner_devclass, usbd_driver_load, 0);
OpenPOWER on IntegriCloud