Changeset View
Changeset View
Standalone View
Standalone View
head/sbin/camcontrol/camcontrol.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 2,320 Lines • ▼ Show 20 Lines | error = ata_do_28bit_cmd(device, | ||||
/*quiet*/0); | /*quiet*/0); | ||||
if (error != 0) { | if (error != 0) { | ||||
free(ptr); | free(ptr); | ||||
return (1); | return (1); | ||||
} | } | ||||
} | } | ||||
ident_buf = (struct ata_params *)ptr; | |||||
ata_param_fixup(ident_buf); | |||||
error = 1; | error = 1; | ||||
for (i = 0; i < sizeof(struct ata_params) / 2; i++) { | for (i = 0; i < sizeof(struct ata_params) / 2; i++) { | ||||
ptr[i] = le16toh(ptr[i]); | |||||
if (ptr[i] != 0) | if (ptr[i] != 0) | ||||
error = 0; | error = 0; | ||||
} | } | ||||
if (arglist & CAM_ARG_VERBOSE) { | if (arglist & CAM_ARG_VERBOSE) { | ||||
fprintf(stdout, "%s%d: Raw identify data:\n", | fprintf(stdout, "%s%d: Raw identify data:\n", | ||||
device->device_name, device->dev_unit_num); | device->device_name, device->dev_unit_num); | ||||
dump_data(ptr, sizeof(struct ata_params)); | dump_data(ptr, sizeof(struct ata_params)); | ||||
} | } | ||||
/* check for invalid (all zero) response */ | /* check for invalid (all zero) response */ | ||||
if (error != 0) { | if (error != 0) { | ||||
warnx("Invalid identify response detected"); | warnx("Invalid identify response detected"); | ||||
free(ptr); | free(ptr); | ||||
return (error); | 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; | *ident_bufp = ident_buf; | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
▲ Show 20 Lines • Show All 7,967 Lines • Show Last 20 Lines |