HGSaneUser修改sane驱动查找目录

This commit is contained in:
luoliangyi 2023-04-04 11:42:27 +08:00
parent 75f47b8f1a
commit 21f91712ac
1 changed files with 24 additions and 1 deletions

View File

@ -13,6 +13,29 @@ HGSaneManagerImpl::~HGSaneManagerImpl()
HGResult HGSaneManagerImpl::Create()
{
std::string archName;
FILE *file = popen("arch", "r");
if (NULL != file)
{
char str[256] = {0};
if (NULL != fgets(str, 256, file))
{
char *p = str;
while (0 != *p && '\n' != *p)
{
archName.push_back(*p);
++p;
}
}
pclose(file);
}
if (archName.empty())
{
return HGBASE_ERR_FAIL;
}
char manuPath[] = "/etc/sane.d/dll.d";
DIR* dir = opendir(manuPath);
@ -70,7 +93,7 @@ HGResult HGSaneManagerImpl::Create()
pr.first = manuName;
char sanePath[256];
sprintf(sanePath, "/usr/lib/x86_64-linux-gnu/sane/libsane-%s.so.1", manuName.c_str());
sprintf(sanePath, "/usr/lib/%s-linux-gnu/sane/libsane-%s.so.1", archName.c_str(), manuName.c_str());
pr.second = sanePath;
m_vSource.push_back(pr);