static int rdident(device_t parent, struct rd_softc *sc, struct hpibbus_attach_args *ha) { struct rd_describe *desc = sc != NULL ? &sc->sc_rddesc : NULL; u_char stat, cmd[3]; char name[7]; int i, id, n, ctlr, slave; ctlr = device_unit(parent); slave = ha->ha_slave; /* Verify that we have a CS80 device. */ if ((ha->ha_id & 0x200) == 0) return 0; /* Is it one of the disks we support? */ for (id = 0; id < numrdidentinfo; id++) if (ha->ha_id == rdidentinfo[id].ri_hwid) break; if (id == numrdidentinfo || ha->ha_punit > rdidentinfo[id].ri_maxunum) return 0; /* * If we're just probing for the device, that's all the * work we need to do. */ if (sc == NULL) return 1; /* * Reset device and collect description */ rdreset(sc); cmd[0] = C_SUNIT(ha->ha_punit); cmd[1] = C_SVOL(0); cmd[2] = C_DESC; hpibsend(ctlr, slave, C_CMD, cmd, sizeof(cmd)); hpibrecv(ctlr, slave, C_EXEC, desc, 37); hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat)); memset(name, 0, sizeof(name)); if (stat == 0) { n = desc->d_name; for (i = 5; i >= 0; i--) { name[i] = (n & 0xf) + '0'; n >>= 4; } }
static int ctident(device_t parent, struct ct_softc *sc, struct hpibbus_attach_args *ha) { struct ct_describe desc; u_char stat, cmd[3]; char name[7]; int i, id, n, type, canstream; type = canstream = 0; /* Verify that we have a CS80 device. */ if ((ha->ha_id & 0x200) == 0) return 0; /* Is it one of the tapes we support? */ for (id = 0; id < nctinfo; id++) if (ha->ha_id == ctinfo[id].hwid) break; if (id == nctinfo) return 0; ha->ha_punit = ctinfo[id].punit; /* * So far, so good. Get drive parameters. Note command * is always issued to unit 0. */ cmd[0] = C_SUNIT(0); cmd[1] = C_SVOL(0); cmd[2] = C_DESC; hpibsend(device_unit(parent), ha->ha_slave, C_CMD, cmd, sizeof(cmd)); hpibrecv(device_unit(parent), ha->ha_slave, C_EXEC, &desc, 37); hpibrecv(device_unit(parent), ha->ha_slave, C_QSTAT, &stat, sizeof(stat)); memset(name, 0, sizeof(name)); if (stat == 0) { n = desc.d_name; for (i = 5; i >= 0; i--) { name[i] = (n & 0xf) + '0'; n >>= 4; } }