Write device identification into syslog.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33042 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen 2009-09-10 21:11:36 +00:00
parent e9fab5adbc
commit a479459113
4 changed files with 31 additions and 0 deletions

View File

@ -832,6 +832,7 @@ ATAChannel::_WriteRegs(ata_task_file *taskFile, ata_reg_mask mask)
return fController->write_command_block_regs(fCookie, taskFile, mask);
}
uint8
ATAChannel::_Status()
{

View File

@ -512,6 +512,22 @@ ATADevice::Identify()
return B_ERROR;
}
if (1) {
// print device information
char modelNumber[sizeof(fInfoBlock.model_number) + 1];
char serialNumber[sizeof(fInfoBlock.serial_number) + 1];
char firmwareRev[sizeof(fInfoBlock.firmware_revision) + 1];
strlcpy(modelNumber, fInfoBlock.model_number, sizeof(modelNumber));
strlcpy(serialNumber, fInfoBlock.serial_number, sizeof(serialNumber));
strlcpy(firmwareRev, fInfoBlock.firmware_revision, sizeof(firmwareRev));
swap_words(modelNumber, sizeof(modelNumber) - 1);
swap_words(serialNumber, sizeof(serialNumber) - 1);
swap_words(firmwareRev, sizeof(firmwareRev) - 1);
TRACE_ALWAYS("model number: %s\n", modelNumber);
TRACE_ALWAYS("serial number: %s\n", serialNumber);
TRACE_ALWAYS("firmware rev.: %s\n", firmwareRev);
}
return B_OK;
}

View File

@ -64,3 +64,15 @@ copy_sg_data(scsi_ccb *ccb, uint offset, uint allocationLength,
return size == 0;
}
void
swap_words(void *data, size_t size)
{
uint16 *word = (uint16 *)data;
size_t count = size / 2;
while (count--) {
*word = (*word << 8) | (*word >> 8);
word++;
}
}

View File

@ -55,6 +55,8 @@ extern device_manager_info *gDeviceManager;
bool copy_sg_data(scsi_ccb *ccb, uint offset, uint allocationLength,
void *buffer, int size, bool toBuffer);
void swap_words(void *data, size_t size);
class ATAChannel {
public: