diff --git a/modules/sane_user/HGSaneImpl.cpp b/modules/sane_user/HGSaneImpl.cpp index c2f3e3cb..34e37dd4 100644 --- a/modules/sane_user/HGSaneImpl.cpp +++ b/modules/sane_user/HGSaneImpl.cpp @@ -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);