version 1.10, 2007/03/13 13:51:57 |
version 1.10.34.2, 2008/06/04 02:05:21 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright |
* 2. Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* documentation and/or other materials provided with the distribution. |
* 3. All advertising materials mentioning features or use of this software |
|
* must display the following acknowledgement: |
|
* This product includes software developed by the NetBSD |
|
* Foundation, Inc. and its contributors. |
|
* 4. Neither the name of The NetBSD Foundation nor the names of its |
|
* contributors may be used to endorse or promote products derived |
|
* from this software without specific prior written permission. |
|
* |
* |
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
Line 213 USB_ATTACH(utoppy) |
|
Line 206 USB_ATTACH(utoppy) |
|
u_int8_t epcount; |
u_int8_t epcount; |
int i; |
int i; |
|
|
|
sc->sc_dev = self; |
|
|
devinfop = usbd_devinfo_alloc(dev, 0); |
devinfop = usbd_devinfo_alloc(dev, 0); |
USB_ATTACH_SETUP; |
USB_ATTACH_SETUP; |
printf("%s: %s\n", USBDEVNAME(sc->sc_dev), devinfop); |
aprint_normal_dev(self, "%s\n", devinfop); |
usbd_devinfo_free(devinfop); |
usbd_devinfo_free(devinfop); |
|
|
sc->sc_dying = 0; |
sc->sc_dying = 0; |
Line 224 USB_ATTACH(utoppy) |
|
Line 219 USB_ATTACH(utoppy) |
|
|
|
if (usbd_set_config_index(dev, 0, 1) |
if (usbd_set_config_index(dev, 0, 1) |
|| usbd_device2interface_handle(dev, 0, &iface)) { |
|| usbd_device2interface_handle(dev, 0, &iface)) { |
printf("%s: Configuration failed\n", USBDEVNAME(sc->sc_dev)); |
aprint_error_dev(self, "Configuration failed\n"); |
USB_ATTACH_ERROR_RETURN; |
USB_ATTACH_ERROR_RETURN; |
} |
} |
|
|
epcount = 0; |
epcount = 0; |
(void) usbd_endpoint_count(iface, &epcount); |
(void) usbd_endpoint_count(iface, &epcount); |
if (epcount != UTOPPY_NUMENDPOINTS) { |
if (epcount != UTOPPY_NUMENDPOINTS) { |
printf("%s: Expected %d endpoints, got %d\n", |
aprint_error_dev(self, "Expected %d endpoints, got %d\n", |
USBDEVNAME(sc->sc_dev), UTOPPY_NUMENDPOINTS, epcount); |
UTOPPY_NUMENDPOINTS, epcount); |
USB_ATTACH_ERROR_RETURN; |
USB_ATTACH_ERROR_RETURN; |
} |
} |
|
|
Line 242 USB_ATTACH(utoppy) |
|
Line 237 USB_ATTACH(utoppy) |
|
for (i = 0; i < epcount; i++) { |
for (i = 0; i < epcount; i++) { |
ed = usbd_interface2endpoint_descriptor(iface, i); |
ed = usbd_interface2endpoint_descriptor(iface, i); |
if (ed == NULL) { |
if (ed == NULL) { |
printf("%s: couldn't get ep %d\n", |
aprint_error_dev(self, "couldn't get ep %d\n", i); |
USBDEVNAME(sc->sc_dev), i); |
|
USB_ATTACH_ERROR_RETURN; |
USB_ATTACH_ERROR_RETURN; |
} |
} |
|
|
Line 257 USB_ATTACH(utoppy) |
|
Line 251 USB_ATTACH(utoppy) |
|
} |
} |
|
|
if (sc->sc_out == -1 || sc->sc_in == -1) { |
if (sc->sc_out == -1 || sc->sc_in == -1) { |
printf("%s: could not find bulk in/out endpoints\n", |
aprint_error_dev(self, |
USBDEVNAME(sc->sc_dev)); |
"could not find bulk in/out endpoints\n"); |
sc->sc_dying = 1; |
sc->sc_dying = 1; |
USB_ATTACH_ERROR_RETURN; |
USB_ATTACH_ERROR_RETURN; |
} |
} |
Line 268 USB_ATTACH(utoppy) |
|
Line 262 USB_ATTACH(utoppy) |
|
|
|
sc->sc_out_xfer = usbd_alloc_xfer(sc->sc_udev); |
sc->sc_out_xfer = usbd_alloc_xfer(sc->sc_udev); |
if (sc->sc_out_xfer == NULL) { |
if (sc->sc_out_xfer == NULL) { |
printf("%s: could not allocate bulk out xfer\n", |
aprint_error_dev(self, "could not allocate bulk out xfer\n"); |
USBDEVNAME(sc->sc_dev)); |
|
goto fail0; |
goto fail0; |
} |
} |
|
|
sc->sc_out_buf = usbd_alloc_buffer(sc->sc_out_xfer, UTOPPY_FRAG_SIZE); |
sc->sc_out_buf = usbd_alloc_buffer(sc->sc_out_xfer, UTOPPY_FRAG_SIZE); |
if (sc->sc_out_buf == NULL) { |
if (sc->sc_out_buf == NULL) { |
printf("%s: could not allocate bulk out buffer\n", |
aprint_error_dev(self, "could not allocate bulk out buffer\n"); |
USBDEVNAME(sc->sc_dev)); |
|
goto fail1; |
goto fail1; |
} |
} |
|
|
sc->sc_in_xfer = usbd_alloc_xfer(sc->sc_udev); |
sc->sc_in_xfer = usbd_alloc_xfer(sc->sc_udev); |
if (sc->sc_in_xfer == NULL) { |
if (sc->sc_in_xfer == NULL) { |
printf("%s: could not allocate bulk in xfer\n", |
aprint_error_dev(self, "could not allocate bulk in xfer\n"); |
USBDEVNAME(sc->sc_dev)); |
|
goto fail1; |
goto fail1; |
} |
} |
|
|
sc->sc_in_buf = usbd_alloc_buffer(sc->sc_in_xfer, UTOPPY_FRAG_SIZE); |
sc->sc_in_buf = usbd_alloc_buffer(sc->sc_in_xfer, UTOPPY_FRAG_SIZE); |
if (sc->sc_in_buf == NULL) { |
if (sc->sc_in_buf == NULL) { |
printf("%s: could not allocate bulk in buffer\n", |
aprint_error_dev(self, "could not allocate bulk in buffer\n"); |
USBDEVNAME(sc->sc_dev)); |
|
goto fail2; |
goto fail2; |
} |
} |
|
|
Line 312 USB_ATTACH(utoppy) |
|
Line 302 USB_ATTACH(utoppy) |
|
int |
int |
utoppy_activate(device_ptr_t self, enum devact act) |
utoppy_activate(device_ptr_t self, enum devact act) |
{ |
{ |
struct utoppy_softc *sc = (struct utoppy_softc *)self; |
struct utoppy_softc *sc = device_private(self); |
|
|
switch (act) { |
switch (act) { |
case DVACT_ACTIVATE: |
case DVACT_ACTIVATE: |