summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2007-08-24 01:16:37 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2007-08-24 01:16:37 +0000
commit7aeef3e995b2114d98a77cc2b73eb7b991aad63a (patch)
treea018e362c787f4bd63b35219d2d2729bf6ba902a /sys
parent15f1fc46d11846e70230b889e949802f72d9cef7 (diff)
On the older devices, apparently early configuration (and doing it again
later) removes the need for forced device disconnection. And now they do not bounce back a few times, but go to 500mA on the 2nd connection.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/uberry.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/sys/dev/usb/uberry.c b/sys/dev/usb/uberry.c
index 8704c9ee2f5..90829d7c88d 100644
--- a/sys/dev/usb/uberry.c
+++ b/sys/dev/usb/uberry.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uberry.c,v 1.11 2007/08/23 02:48:04 deraadt Exp $ */
+/* $OpenBSD: uberry.c,v 1.12 2007/08/24 01:16:36 deraadt Exp $ */
/*-
* Copyright (c) 2006 Theo de Raadt <deraadt@openbsd.org>
@@ -44,6 +44,7 @@ struct uberry_softc {
usbd_interface_handle sc_iface;
};
+#define UBERRY_INTERFACE_NO 0
#define UBERRY_CONFIG_NO 1
struct usb_devno const uberry_devices[] = {
@@ -100,7 +101,7 @@ uberry_attach(struct device *parent, struct device *self, void *aux)
printf("\n%s: %s\n", sc->sc_dev.dv_xname, devinfop);
usbd_devinfo_free(devinfop);
- /* Enable the device, then it cannot idle, and will charge */
+ /* Enable configuration, to keep it connected... */
if (usbd_set_config_no(sc->sc_udev, UBERRY_CONFIG_NO, 1) != 0) {
printf("%s: could not set configuration no\n",
sc->sc_dev.dv_xname);
@@ -114,12 +115,29 @@ uberry_attach(struct device *parent, struct device *self, void *aux)
else {
printf("... requesting higher-power charging\n");
uberry_charge(sc);
- usb_needs_reattach(sc->sc_udev);
+ /*
+ * Older berry's will disconnect/reconnect at this
+ * point, and come back requesting higher power
+ */
}
- if (UGETW(dd->idProduct) == USB_PRODUCT_RIM_PEARL) {
- /* Request a change to Dual mode */
+ /* On the Pearl, request a change to Dual mode */
+ if (UGETW(dd->idProduct) == USB_PRODUCT_RIM_PEARL)
uberry_pearlmode(sc);
+
+ /* Enable the device, then it cannot idle, and will charge */
+ if (usbd_set_config_no(sc->sc_udev, UBERRY_CONFIG_NO, 1) != 0) {
+ printf("%s: could not set configuration no\n",
+ sc->sc_dev.dv_xname);
+ return;
+ }
+
+ if (UGETW(dd->idProduct) == USB_PRODUCT_RIM_PEARL) {
+ /*
+ * Pearl does not disconnect/reconnect by itself,
+ * and therefore needs to be told to reset, so that
+ * it can come back in Dual mode.
+ */
usb_needs_reattach(sc->sc_udev);
}