Subject: Re: usb-cdrom
To: None <btm@pobox.com>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: current-users
Date: 05/01/2001 19:49:38
--jRHKVT23PllUwdXP
Content-Type: text/plain; charset=us-ascii

On Tue, May 01, 2001 at 10:14:12AM -0400, btm@pobox.com wrote:
> I believe the problem is that atapibus doesn't seem to want to connect to
> usb mass devices anymore.  I have a compact flash card reader that

Ok, I think I found why. The attached patch should fix it; can you test ?

--
Manuel Bouyer <bouyer@antioche.eu.org>
--

--jRHKVT23PllUwdXP
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: umassbus.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/usb/umassbus.c,v
retrieving revision 1.5
diff -u -r1.5 umassbus.c
--- umassbus.c	2001/04/28 14:48:40	1.5
+++ umassbus.c	2001/05/01 17:47:35
@@ -1,4 +1,4 @@
-/*	$NetBSD: umassbus.c,v 1.4 2001/04/25 17:53:42 bouyer Exp $	*/
+/*	$NetBSD: umassbus.c,v 1.5 2001/04/28 14:48:40 augustss Exp $	*/
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -94,6 +94,9 @@
 int
 umass_attach_bus(struct umass_softc *sc)
 {
+	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
+			   USBDEV(sc->sc_dev));
+
 	/*
 	 * Fill in the adapter.
 	 */
@@ -109,7 +112,7 @@
 	/* fill in the channel */
 	memset(&sc->bus.sc_channel, 0, sizeof(sc->bus.sc_channel));
 	sc->bus.sc_channel.chan_adapter = &sc->bus.sc_adapter;
-	sc->bus.sc_channel.chan_channel = 1;
+	sc->bus.sc_channel.chan_channel = 0;
 	sc->bus.sc_channel.chan_flags = SCSIPI_CHAN_OPENINGS;
 	sc->bus.sc_channel.chan_openings = 1;
 	sc->bus.sc_channel.chan_max_periph = 1;
@@ -123,6 +126,8 @@
 		sc->bus.sc_channel.chan_nluns = sc->maxlun + 1;
 		sc->bus.sc_channel.chan_id = UMASS_SCSIID_HOST;
 		sc->bus.sc_channel.type = BUS_SCSI;
+		sc->bus.sc_child =
+		    config_found(&sc->sc_dev, &sc->bus.sc_channel, scsipiprint);
 		break;
 
 #if NATAPIBUS > 0
@@ -136,9 +141,11 @@
 		sc->bus.aa.sc_aa.aa_channel = 0;
 		sc->bus.aa.sc_aa.aa_openings = 1;
 		sc->bus.aa.sc_aa.aa_drv_data = &sc->bus.aa.sc_aa_drive;
-		sc->bus.aa.sc_aa.aa_bus_private = &sc->bus.sc_atapi_adapter;
+		sc->bus.aa.sc_aa.aa_bus_private = &sc->bus.sc_channel;
 		if (sc->quirks & NO_TEST_UNIT_READY)
 			sc->bus.sc_channel.chan_defquirks |= PQUIRK_NOTUR;
+		sc->bus.sc_child =
+		    config_found(&sc->sc_dev, &sc->bus.aa.sc_aa, scsipiprint);
 		break;
 #endif
 
@@ -148,11 +155,6 @@
 		return (1);
 	}
 
-	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev,
-			   USBDEV(sc->sc_dev));
-
-	sc->bus.sc_child =
-	    config_found(&sc->sc_dev, &sc->bus.sc_channel, scsipiprint);
 	if (sc->bus.sc_child == NULL) {
 		/* Not an error, just not a complete success. */
 		return (1);

--jRHKVT23PllUwdXP--