#! /bin/sh /usr/share/dpatch/dpatch-run ## 65_cciss_smartd.dpatch.dpatch by ## Frédéric Boiteux ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: correct support for Compaq/HP CCISS controllers for smartd daemon @DPATCH@ --- smartmontools-5.36-6.orig/smartd.c 2006-09-28 15:49:58.000000000 +0200 +++ smartmontools-5.36-6.mod/smartd.c 2006-09-28 15:53:22.000000000 +0200 @@ -1616,12 +1616,16 @@ char *device = cfg->name; struct scsi_iec_mode_page iec; UINT8 tBuf[64]; + char *mode=NULL; // should we try to register this as a SCSI device? switch (cfg->controller_type) { case CONTROLLER_SCSI: - case CONTROLLER_CCISS: case CONTROLLER_UNKNOWN: + mode="SCSI"; + break; + case CONTROLLER_CCISS: + mode="CCISS"; break; default: return 1; @@ -1631,7 +1635,7 @@ con->controller_type=cfg->controller_type; // open the device - if ((fd = OpenDevice(device, "SCSI", scanning)) < 0) + if ((fd = OpenDevice(device, mode, scanning)) < 0) return 1; PrintOut(LOG_INFO,"Device: %s, opened\n", device); @@ -1707,7 +1711,8 @@ } // record type of device - cfg->controller_type = CONTROLLER_SCSI; + if (cfg->controller_type == CONTROLLER_UNKNOWN) + cfg->controller_type = CONTROLLER_SCSI; // get rid of allocated memory only needed for ATA devices. These // might have been allocated if the user specified Ignore options or @@ -2426,6 +2431,24 @@ int fd; char *name=cfg->name; const char *cp; + char *mode=NULL; + + // should we try to register this as a SCSI device? + switch (cfg->controller_type) { + case CONTROLLER_CCISS: + mode="CCISS"; + break; + case CONTROLLER_SCSI: + case CONTROLLER_UNKNOWN: + mode="SCSI"; + break; + default: + return 1; + } + + // pass user settings on to low-level SCSI commands + con->controller_port=cfg->controller_port; + con->controller_type=cfg->controller_type; // If the user has asked for it, test the email warning system if (cfg->mailwarn && cfg->mailwarn->emailtest) @@ -2433,7 +2456,7 @@ // if we can't open device, fail gracefully rather than hard -- // perhaps the next time around we'll be able to open it - if ((fd=OpenDevice(name, "SCSI", 0))<0) { + if ((fd=OpenDevice(name, mode, 0))<0) { // Lack of PrintOut() here is intentional! MailWarning(cfg, 9, "Device: %s, unable to open device", name); return 1;