diff options
-rw-r--r-- | sys/dev/usb/umass_scsi.c | 24 | ||||
-rw-r--r-- | sys/scsi/scsiconf.c | 5 | ||||
-rw-r--r-- | sys/scsi/scsiconf.h | 3 |
3 files changed, 29 insertions, 3 deletions
diff --git a/sys/dev/usb/umass_scsi.c b/sys/dev/usb/umass_scsi.c index 86e94902e02..a9f3eba18ed 100644 --- a/sys/dev/usb/umass_scsi.c +++ b/sys/dev/usb/umass_scsi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umass_scsi.c,v 1.31 2010/09/21 02:41:24 dlg Exp $ */ +/* $OpenBSD: umass_scsi.c,v 1.32 2011/04/06 15:16:54 dlg Exp $ */ /* $NetBSD: umass_scsipi.c,v 1.9 2003/02/16 23:14:08 augustss Exp $ */ /* * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -70,6 +70,7 @@ struct umass_scsi_softc { #define UMASS_ATAPI_DRIVE 0 +int umass_scsi_probe(struct scsi_link *); void umass_scsi_cmd(struct scsi_xfer *); void umass_scsi_minphys(struct buf *, struct scsi_link *); @@ -154,6 +155,7 @@ umass_scsi_setup(struct umass_softc *sc) /* Fill in the adapter. */ scbus->sc_adapter.scsi_cmd = umass_scsi_cmd; scbus->sc_adapter.scsi_minphys = umass_scsi_minphys; + scbus->sc_adapter.dev_probe = umass_scsi_probe; /* Fill in the link. */ scbus->sc_link.adapter_buswidth = 2; @@ -166,6 +168,26 @@ umass_scsi_setup(struct umass_softc *sc) return (scbus); } +int +umass_scsi_probe(struct scsi_link *link) +{ + struct umass_softc *sc = link->adapter_softc; + struct usb_device_info udi; + + /* dont fake devids when more than one scsi device can attach. */ + if (sc->maxlun > 0) + return (0); + + usbd_fill_deviceinfo(sc->sc_udev, &udi, 1); + if (strlen(udi.udi_serial) > 0) { + link->id = devid_alloc(DEVID_SERIAL, DEVID_F_PRINT, + min(strlen(udi.udi_serial), sizeof(udi.udi_serial)), + udi.udi_serial); + } + + return (0); +} + void umass_scsi_cmd(struct scsi_xfer *xs) { diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c index 3718c0e331c..04df4b3d411 100644 --- a/sys/scsi/scsiconf.c +++ b/sys/scsi/scsiconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.c,v 1.172 2011/04/06 13:33:46 dlg Exp $ */ +/* $OpenBSD: scsiconf.c,v 1.173 2011/04/06 15:16:54 dlg Exp $ */ /* $NetBSD: scsiconf.c,v 1.57 1996/05/02 01:09:01 neil Exp $ */ /* @@ -782,6 +782,9 @@ scsibus_printlink(struct scsi_link *link) case DEVID_T10: printf(" t10."); break; + case DEVID_SERIAL: + printf(" serial."); + break; } if (ISSET(link->id->d_flags, DEVID_F_PRINT)) { diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h index e9a5f80e8b5..aebaffa35db 100644 --- a/sys/scsi/scsiconf.h +++ b/sys/scsi/scsiconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scsiconf.h,v 1.143 2011/04/05 14:25:42 dlg Exp $ */ +/* $OpenBSD: scsiconf.h,v 1.144 2011/04/06 15:16:54 dlg Exp $ */ /* $NetBSD: scsiconf.h,v 1.35 1997/04/02 02:29:38 mycroft Exp $ */ /* @@ -233,6 +233,7 @@ _4ltol(u_int8_t *bytes) #define DEVID_NAA 1 #define DEVID_EUI 2 #define DEVID_T10 3 +#define DEVID_SERIAL 4 struct devid { u_int8_t d_type; |