If SANE returns empty device list treat it as an error.

This commit is contained in:
Dmitry Timoshkov 2005-11-18 12:05:05 +00:00 committed by Alexandre Julliard
parent e1b644b439
commit d389f471b6
1 changed files with 11 additions and 3 deletions

View File

@ -146,17 +146,25 @@ TW_UINT16 TWAIN_IdentityGetFirst (pTW_IDENTITY pOrigin, TW_MEMREF pData)
{ {
if (device_list[0]) if (device_list[0])
{ {
TRACE("got: %s, %s, %s\n", device_list[0]->name, device_list[0]->vendor, device_list[0]->model);
pSourceIdentity->Id = DSM_sourceId ++; pSourceIdentity->Id = DSM_sourceId ++;
strcpy (pSourceIdentity->ProductName, device_list[0]->name); strcpy (pSourceIdentity->ProductName, device_list[0]->name);
strcpy (pSourceIdentity->Manufacturer, device_list[0]->vendor); strcpy (pSourceIdentity->Manufacturer, device_list[0]->vendor);
strcpy (pSourceIdentity->ProductFamily, device_list[0]->model); strcpy (pSourceIdentity->ProductFamily, device_list[0]->model);
pSourceIdentity->ProtocolMajor = TWON_PROTOCOLMAJOR; pSourceIdentity->ProtocolMajor = TWON_PROTOCOLMAJOR;
pSourceIdentity->ProtocolMinor = TWON_PROTOCOLMINOR; pSourceIdentity->ProtocolMinor = TWON_PROTOCOLMINOR;
}
DSM_currentDevice = 1; DSM_currentDevice = 1;
twRC = TWRC_SUCCESS; twRC = TWRC_SUCCESS;
DSM_twCC = TWCC_SUCCESS; DSM_twCC = TWCC_SUCCESS;
} }
else
{
TRACE("got empty device list\n");
twRC = TWRC_FAILURE;
DSM_twCC = TWCC_NODS;
}
}
else if (status == SANE_STATUS_NO_MEM) else if (status == SANE_STATUS_NO_MEM)
{ {
twRC = TWRC_FAILURE; twRC = TWRC_FAILURE;