Bug #942 ยป ulpt.patch
sys/dev/usbmisc/ulpt/ulpt.c 7 Feb 2008 11:39:41 -0000 | ||
---|---|---|
int sc_refcnt;
|
||
u_char sc_dying;
|
||
int vendor;
|
||
int product;
|
||
};
|
||
static d_open_t ulptopen;
|
||
... | ... | |
sc->sc_in = -1;
|
||
sc->sc_out = -1;
|
||
sc->vendor = uaa->vendor;
|
||
sc->product = uaa->product;
|
||
for (i = 0; i < epcount; i++) {
|
||
ed = usbd_interface2endpoint_descriptor(iface, i);
|
||
if (ed == NULL) {
|
||
... | ... | |
ulpt_reset(struct ulpt_softc *sc)
|
||
{
|
||
usb_device_request_t req;
|
||
int other_fails;
|
||
/* The Brother HL1240 doesn't handle UT_WRITE_CLASS_OTHER */
|
||
other_fails = (sc->vendor == 0x04f9 && sc->product == 0x0006);
|
||
DPRINTFN(1, ("ulpt_reset\n"));
|
||
req.bRequest = UR_SOFT_RESET;
|
||
... | ... | |
* so we try both.
|
||
*/
|
||
req.bmRequestType = UT_WRITE_CLASS_OTHER;
|
||
if (usbd_do_request(sc->sc_udev, &req, 0)) { /* 1.0 */
|
||
/* Some printers don't handle UT_WRITE_CLASS_OTHER */
|
||
if (other_fails || usbd_do_request(sc->sc_udev, &req, 0)) {/* 1.0 */
|
||
req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
|
||
(void)usbd_do_request(sc->sc_udev, &req, 0); /* 1.1 */
|
||
}
|