设备名称带唯一标识
This commit is contained in:
parent
b117cbc8bd
commit
0b4263e751
|
@ -271,7 +271,6 @@ void hg_scanner_mgr::on_hgscanner_pnp(usb_event ev, libusb_device* device, int v
|
|||
{
|
||||
if (g_supporting_devices[i].vid == vid && g_supporting_devices[i].pid == pid)
|
||||
{
|
||||
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "%s connected.\n", g_supporting_devices[i].name.c_str());
|
||||
index = i;
|
||||
ev_ui = SANE_EVENT_DEVICE_ARRIVED;
|
||||
name = g_supporting_devices[i].name.c_str();
|
||||
|
@ -326,6 +325,7 @@ void hg_scanner_mgr::on_hgscanner_pnp(usb_event ev, libusb_device* device, int v
|
|||
libusb_ref_device(ols.dev); // ref to the device of queue online_devices_
|
||||
online_devices_.push_back(ols);
|
||||
name = ols.display_name;
|
||||
VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "%s connected.\n", name.c_str());
|
||||
type = g_supporting_devices[ols.ind].type;
|
||||
}
|
||||
else if (online_devices_[i].scanner && !online_devices_[i].scanner->is_online())
|
||||
|
@ -342,9 +342,9 @@ void hg_scanner_mgr::on_hgscanner_pnp(usb_event ev, libusb_device* device, int v
|
|||
if (pid == 0x300 || pid == 0x400)
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||
len = usb_manager::instance()->open(device, &io);
|
||||
VLOG_MINI_3(LOG_LEVEL_WARNING, "[%04x:%04x]%s re-connected.\n", pid, vid, online_devices_[i].display_name.c_str());
|
||||
if (len == SCANNER_ERR_OK)
|
||||
{
|
||||
VLOG_MINI_3(LOG_LEVEL_WARNING, "[%04x:%04x]%s re-connected.\n", pid, vid, online_devices_[i].display_name.c_str());
|
||||
online_devices_[i].scanner->reset_io(io);
|
||||
de.openned = SANE_TRUE;
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ scanner_err hg_scanner_mgr::hg_scanner_open(scanner_handle* h, const char* name,
|
|||
ret = (scanner_err)usb_manager::instance()->open(it->dev, &io, &msg);
|
||||
if (ret == SCANNER_ERR_OK)
|
||||
{
|
||||
hg_scanner* scanner = g_supporting_devices[it->ind].create_scanner(g_supporting_devices[it->ind].name.c_str(), io, h);
|
||||
hg_scanner* scanner = g_supporting_devices[it->ind].create_scanner(it->display_name.c_str(), io, h);
|
||||
if (!scanner)
|
||||
{
|
||||
if (g_supporting_devices[it->ind].pid == 0x100 ||
|
||||
|
@ -588,7 +588,7 @@ scanner_err hg_scanner_mgr::hg_scanner_open(scanner_handle* h, const char* name,
|
|||
g_supporting_devices[it->ind].pid == 0x8620 ||
|
||||
g_supporting_devices[it->ind].pid == 0x8730)
|
||||
{
|
||||
hg_scanner_200* s200 = new hg_scanner_200(g_supporting_devices[it->ind].name.c_str(), 0x100, io);
|
||||
hg_scanner_200* s200 = new hg_scanner_200(it->display_name.c_str(), 0x100, io);
|
||||
|
||||
scanner = dynamic_cast<hg_scanner*>(s200);
|
||||
*h = (scanner_handle)s200;
|
||||
|
@ -603,7 +603,7 @@ scanner_err hg_scanner_mgr::hg_scanner_open(scanner_handle* h, const char* name,
|
|||
g_supporting_devices[it->ind].pid == 0x7039 ||
|
||||
g_supporting_devices[it->ind].pid == 0x8529)
|
||||
{
|
||||
hg_scanner_239* s239 = new hg_scanner_239(g_supporting_devices[it->ind].name.c_str(), 0x239, io);
|
||||
hg_scanner_239* s239 = new hg_scanner_239(it->display_name.c_str(), 0x239, io);
|
||||
|
||||
scanner = dynamic_cast<hg_scanner*>(s239);
|
||||
*h = (scanner_handle)s239;
|
||||
|
@ -612,7 +612,7 @@ scanner_err hg_scanner_mgr::hg_scanner_open(scanner_handle* h, const char* name,
|
|||
g_supporting_devices[it->ind].pid == 0x7000 ||
|
||||
g_supporting_devices[it->ind].pid == 0x8520)
|
||||
{
|
||||
hg_scanner_400* s400 = new hg_scanner_400(g_supporting_devices[it->ind].name.c_str(), 0x400, io);
|
||||
hg_scanner_400* s400 = new hg_scanner_400(it->display_name.c_str(), 0x400, io);
|
||||
scanner = dynamic_cast<hg_scanner*>(s400);
|
||||
*h = (scanner_handle)s400;
|
||||
}
|
||||
|
@ -620,7 +620,7 @@ scanner_err hg_scanner_mgr::hg_scanner_open(scanner_handle* h, const char* name,
|
|||
g_supporting_devices[it->ind].pid == 0x1000 ||
|
||||
g_supporting_devices[it->ind].pid == 0x8420)
|
||||
{
|
||||
hg_scanner_300* s300 = new hg_scanner_300(g_supporting_devices[it->ind].name.c_str(), 0x300, io);
|
||||
hg_scanner_300* s300 = new hg_scanner_300(it->display_name.c_str(), 0x300, io);
|
||||
scanner = dynamic_cast<hg_scanner*>(s300);
|
||||
*h = (scanner_handle)s300;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue