aboutsummaryrefslogtreecommitdiff
path: root/sbin/camcontrol/camcontrol.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/camcontrol/camcontrol.c')
-rw-r--r--sbin/camcontrol/camcontrol.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/sbin/camcontrol/camcontrol.c b/sbin/camcontrol/camcontrol.c
index 99d59e59d86c..0784fab75a0e 100644
--- a/sbin/camcontrol/camcontrol.c
+++ b/sbin/camcontrol/camcontrol.c
@@ -2326,11 +2326,9 @@ ata_do_identify(struct cam_device *device, int retry_count, int timeout,
}
}
- ident_buf = (struct ata_params *)ptr;
- ata_param_fixup(ident_buf);
-
error = 1;
for (i = 0; i < sizeof(struct ata_params) / 2; i++) {
+ ptr[i] = le16toh(ptr[i]);
if (ptr[i] != 0)
error = 0;
}
@@ -2348,6 +2346,26 @@ ata_do_identify(struct cam_device *device, int retry_count, int timeout,
return (error);
}
+ ident_buf = (struct ata_params *)ptr;
+ if (strncmp(ident_buf->model, "FX", 2) &&
+ strncmp(ident_buf->model, "NEC", 3) &&
+ strncmp(ident_buf->model, "Pioneer", 7) &&
+ strncmp(ident_buf->model, "SHARP", 5)) {
+ ata_bswap(ident_buf->model, sizeof(ident_buf->model));
+ ata_bswap(ident_buf->revision, sizeof(ident_buf->revision));
+ ata_bswap(ident_buf->serial, sizeof(ident_buf->serial));
+ ata_bswap(ident_buf->media_serial, sizeof(ident_buf->media_serial));
+ }
+ ata_btrim(ident_buf->model, sizeof(ident_buf->model));
+ ata_bpack(ident_buf->model, ident_buf->model, sizeof(ident_buf->model));
+ ata_btrim(ident_buf->revision, sizeof(ident_buf->revision));
+ ata_bpack(ident_buf->revision, ident_buf->revision, sizeof(ident_buf->revision));
+ ata_btrim(ident_buf->serial, sizeof(ident_buf->serial));
+ ata_bpack(ident_buf->serial, ident_buf->serial, sizeof(ident_buf->serial));
+ ata_btrim(ident_buf->media_serial, sizeof(ident_buf->media_serial));
+ ata_bpack(ident_buf->media_serial, ident_buf->media_serial,
+ sizeof(ident_buf->media_serial));
+
*ident_bufp = ident_buf;
return (0);