From owner-freebsd-scsi Tue Mar 28 12:19:23 2000 Delivered-To: freebsd-scsi@freebsd.org Received: from bluebottle.calcaphon.com (calcaphon.demon.co.uk [193.237.19.5]) by hub.freebsd.org (Postfix) with ESMTP id 37CC237BB34 for ; Tue, 28 Mar 2000 12:19:14 -0800 (PST) (envelope-from n_hibma@calcaphon.com) Received: from henny.calcaphon.com (henny.calcaphon.com [10.0.0.36]) by bluebottle.calcaphon.com (8.9.3/8.9.1) with ESMTP id VAA74225 for ; Tue, 28 Mar 2000 21:23:56 +0100 (BST) (envelope-from n_hibma@calcaphon.com) Date: Tue, 28 Mar 2000 21:16:38 +0100 (BST) From: Nick Hibma X-Sender: n_hibma@localhost Reply-To: Nick Hibma To: FreeBSD SCSI Mailing List Subject: Bus rescan (second try) 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 The fragment below is intended to rescan the bus on connection of a device. The problem is that cam_periph_find always returns NULL, because a SIM does not seem to have a periph. An option would be to make xpt_periph available in cam_periph.h. Or someone telling me how to do the rescan on connection of a drive. I think I've tried everything imaginable. Nick /* Create a path and lookup the peripheral for the SIM */ if (xpt_create_path(&path, NULL, cam_sim_path(umass_sim), UMASS_SCSIID_HOST, 0) != CAM_REQ_CMP) return; periph = cam_periph_find(path, DEVNAME); if (periph == NULL) { DPRINTF(UDMASS_SCSI, ("%s:%d:%d:%d: no periph\n", USBDEVNAME(sc->sc_dev), cam_sim_path(umass_sim), device_get_unit(sc->sc_dev), 0)); xpt_free_path(path); return; } xpt_free_path(path); /* Lookup the path again, but now include the periph in the path*/ if (xpt_create_path(&path, periph, cam_sim_path(umass_sim), UMASS_SCSIID_HOST, 0) != CAM_REQ_CMP) return; xpt_setup_ccb(&ccb->ccb_h, path, 5/*priority (low)*/); ccb->ccb_h.func_code = XPT_SCAN_BUS; ccb->ccb_h.cbfcnp = umass_cam_rescan_callback; ccb->crcn.flags = CAM_FLAG_NONE; xpt_action(ccb); -- n_hibma@webweaving.org 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