{"action":"created","issue":{"url":"https://api.github.com/repos/grodansparadis/vscp_software/issues/127","labels_url":"https://api.github.com/repos/grodansparadis/vscp_software/issues/127/labels{/name}","comments_url":"https://api.github.com/repos/grodansparadis/vscp_software/issues/127/comments","events_url":"https://api.github.com/repos/grodansparadis/vscp_software/issues/127/events","html_url":"https://github.com/grodansparadis/vscp_software/issues/127","id":71601419,"number":127,"title":"vscpl1_usb2candrv.dll not able to open more than one interface","user":{"login":"datenheim","id":101634,"avatar_url":"https://avatars.githubusercontent.com/u/101634?v=3","gravatar_id":"","url":"https://api.github.com/users/datenheim","html_url":"https://github.com/datenheim","followers_url":"https://api.github.com/users/datenheim/followers","following_url":"https://api.github.com/users/datenheim/following{/other_user}","gists_url":"https://api.github.com/users/datenheim/gists{/gist_id}","starred_url":"https://api.github.com/users/datenheim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/datenheim/subscriptions","organizations_url":"https://api.github.com/users/datenheim/orgs","repos_url":"https://api.github.com/users/datenheim/repos","events_url":"https://api.github.com/users/datenheim/events{/privacy}","received_events_url":"https://api.github.com/users/datenheim/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":10,"created_at":"2015-04-28T14:16:29Z","updated_at":"2015-05-07T15:00:16Z","closed_at":null,"body":"System: Windows 7-64, latest release of vscpd/works, USB2CAN interface with firmware 1.5 (latest)\r\n\r\nNeither the usb2can.dll provided by 8devices nor the vscpl1_usb2candrv.dll provided in:\r\nhttps://github.com/grodansparadis/vscp_software/tree/master/src/vscp/drivers/level1/usb2can\r\n\r\nis able to open more than one CAN interface at any one time. This seems to be known problem, as in file\r\nhttps://github.com/grodansparadis/vscp_software/blob/master/src/vscp/drivers/level1/usb2can/usb2can/common/dlldrvobj.h\r\nline 41 the maximum number of opened drivers is limited to 1. Changing this constant from 1 to 256 does not change the behaviour - still only one channel can be opened, further calls to CanalOpen() will not do anything but return an error.\r\n\r\nFurthermore the handle returned by CanalOpen() is always 1681 for any number of usb2can-interfaces on the same machine.\r\n\r\nThat said, it seems that in file\r\nhttps://github.com/grodansparadis/vscp_software/blob/master/src/vscp/drivers/level1/usb2can/usb2can/common/dlldrvobj.cpp\r\nin line 178 we get always 1681 as handle. This may be the case because the break in line 179 always breaks the for-loop counting through all interfaces.\r\n\r\nSadly even with removing the break (which seems to be obvious) the dll is still not able to open multiple interfaces - but the returned handle now changes, at least sometimes, to values of 1681, 1682, 1683 and 1684 (and probably more) - but still only one usb2can is delivering data.\r\n\r\nReproduction:\r\n1. have two usb2can-interfaces with different serial numbers,\r\n    having at least one node running on each interface makes sense,\r\n    but is not required to produce the error\r\n\r\n2. configure vscpd to have those two interfaces enabled and supported\r\n\r\n3. start vscpd and watch the debug output\r\n\r\nI always got:\r\n```shell\r\nD:\\sglux\\vscp>vscpd -v\r\n2015-04-27 17:00:50 - Reading configuration from [C:\\ProgramData/vscp/vscpd.conf]\r\n2015-04-27 17:00:50 - Level I driver added. - [ D:\\sglux\\usb2can-dll-versionen\\vscpl1_usb2candrv-open255-olesch.dll ]\r\n2015-04-27 17:00:50 - Level I driver added. - [ D:\\sglux\\usb2can-dll-versionen\\vscpl1_usb2candrv-open255-olesch.dll ]\r\n2015-04-27 17:00:50 - VSCP Daemon started\r\nVersion: 1.0.0.43 Neon\r\nCopyright (C) 2000-2014, Grodans Paradis AB, http://www.paradiseofthefrog.com\r\n2015-04-27 17:00:50 - Log Level=1\r\n2015-04-27 17:00:50 - DM enabled.\r\n2015-04-27 17:00:50 - Variables enabled.\r\n2015-04-27 17:00:50 - TCP/IP interface enabled.\r\n2015-04-27 17:00:50 - WebServer interface active.\r\n2015-04-27 17:00:50 - Level I drivers enabled.\r\n2015-04-27 17:00:50 - USB2CAN_206 Started at 2015-04-27 17:00:50\r\n2015-04-27 17:00:50 - USB2CAN_221 Started at 2015-04-27 17:00:50\r\n2015-04-27 17:00:50 - TCP Client: Thread started.\r\n2015-04-27 17:00:50 - Loading level I driver: USB2CAN_221\r\n2015-04-27 17:00:50 - Loading level I driver: USB2CAN_206\r\n2015-04-27 17:00:50 - Failed to open driver. Will not use it!\r\n        [ USB2CAN_206 ]\r\n2015-04-27 17:00:50 - Driver USB2CAN_221 opended.\r\n```\r\nAssumption: the strange thing is that always the same handle is returned by CanalOpen() - cause unknown so far."},"comment":{"url":"https://api.github.com/repos/grodansparadis/vscp_software/issues/comments/99899793","html_url":"https://github.com/grodansparadis/vscp_software/issues/127#issuecomment-99899793","issue_url":"https://api.github.com/repos/grodansparadis/vscp_software/issues/127","id":99899793,"user":{"login":"datenheim","id":101634,"avatar_url":"https://avatars.githubusercontent.com/u/101634?v=3","gravatar_id":"","url":"https://api.github.com/users/datenheim","html_url":"https://github.com/datenheim","followers_url":"https://api.github.com/users/datenheim/followers","following_url":"https://api.github.com/users/datenheim/following{/other_user}","gists_url":"https://api.github.com/users/datenheim/gists{/gist_id}","starred_url":"https://api.github.com/users/datenheim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/datenheim/subscriptions","organizations_url":"https://api.github.com/users/datenheim/orgs","repos_url":"https://api.github.com/users/datenheim/repos","events_url":"https://api.github.com/users/datenheim/events{/privacy}","received_events_url":"https://api.github.com/users/datenheim/received_events","type":"User","site_admin":false},"created_at":"2015-05-07T15:00:16Z","updated_at":"2015-05-07T15:00:16Z","body":"Today we were able to successfully open two USB2CAN with vscpd as well as our own software (labview), got different handles and could receive data from the nodes.\r\n\r\nNext tasks:\r\n* test with more than 2 usb2can and more nodes\r\n* node-reconnect with own software\r\n* investigate the CEnum::MAX_USB_DEVICES impact as Andreas noted\r\n\r\nand I will report here."}}