From owner-freebsd-scsi Thu Nov 25 7:27:51 1999 Delivered-To: freebsd-scsi@freebsd.org Received: from ns.skylink.it (ns.skylink.it [194.177.113.1]) by hub.freebsd.org (Postfix) with ESMTP id 021B414E68 for ; Thu, 25 Nov 1999 07:27:45 -0800 (PST) (envelope-from hibma@skylink.it) Received: from skylink.it (va-151.skylink.it [194.185.55.151]) by ns.skylink.it (8.9.1/8.8.8) with ESMTP id QAA17646 for ; Thu, 25 Nov 1999 16:28:11 +0100 Received: from localhost (localhost [127.0.0.1]) by skylink.it (8.9.3/8.9.3) with ESMTP id PAA01663 for ; Thu, 25 Nov 1999 15:38:13 +0100 (CET) (envelope-from hibma@skylink.it) Date: Thu, 25 Nov 1999 15:38:13 +0100 (CET) From: Nick Hibma X-Sender: n_hibma@henny.jrc.it Reply-To: Nick Hibma To: FreeBSD SCSI Mailing List Subject: Re: found device. In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org For your information: The following code fails as well: union ccb *ccb = NULL; struct ccb_getdev *cgd = (struct ccb_getdev *)ccb; ccb = malloc(sizeof(union ccb), M_USBDEV, M_WAITOK); memset(ccb, 0, sizeof(union ccb)); cgd->ccb_h.func_code = XPT_GDEV_TYPE; if (xpt_create_path(&sc->path, NULL, cam_sim_path(umass_sim), device_get_unit(sc->sc_dev), CAM_LUN_WILDCARD) != CAM_REQ_CMP) return(ENOMEM); xpt_async(AC_FOUND_DEVICE, sc->path, cgd); free(ccb, M_USBDEV); This code bombs passasync() (the code fragment below just silently fails). Cheers, Nick > How do I make sure the bus is rescanned when a new target has appeared? > > Whenever a new device is attached, I would like the SCSI bus to which it > is connected to be rescanned. The following code however doesn't do the > job it seems (FYI: All USB Zip drives are connected to 1 SCSI bus, bus > 0). > > Nick > > > static int > umass_cam_rescan(umass_softc_t *sc) > { > union ccb *ccb; > struct cam_path *path; > struct cam_periph *periph; > > if (xpt_create_path(&path, NULL, CAM_XPT_PATH_ID, > CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) > != CAM_REQ_CMP) > return(ENOMEM); > > periph = cam_periph_find(path, NULL/*name*/); > if (!periph) > return(EINVAL); > > if (xpt_create_path(&sc->path, periph, cam_sim_path(umass_sim), > device_get_unit(sc->sc_dev), CAM_LUN_WILDCARD) > != CAM_REQ_CMP) > return(ENOMEM); > > ccb = malloc(sizeof(union ccb), M_DEVBUF, M_WAITOK); > xpt_setup_ccb(&ccb->ccb_h, sc->path, 5/*priority (low)*/); > ccb->ccb_h.func_code = XPT_SCAN_LUN; > ccb->ccb_h.cbfcnp = umass_cam_attach_callback; > ccb->crcn.flags = CAM_FLAG_NONE; > xpt_action(ccb); > > return(0); > } > > > > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-scsi" in the body of the message > -- hibma@skylink.it n_hibma@freebsd.org USB project http://www.etla.net/~n_hibma/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message