Multiple Identical Barcode Scanners with OPOS drivers


  • Hello,

    I am interested in retrieving data from a number of barcode scanners which are connected via USB to a machine. There will be around 6 of them. The scanner model is Datalogic Magellan 3300. The company only provides legacy OPOS drivers. I don't have the physical devices yet, so I'm just trying to anticipate here.

    When installing these drivers on my machine, I get a whole bunch of device classes under OLEforRetail\ServiceOPOS\Scanner. In my code, I'm using POSExplorer.GetDevices() to retrieve all these devices after which I'm filtering each device based on Type=="Scanner". This will effectively list all the devices that appear in Registry. 

    However, not all items in the GetDevices() list correspond to scanners which are physically connected. One of them is the MS Scanner Simulator. How do I determine which items stand for my currently connected physical devices?

    I know that with Service Objects one can create a configuration file and associate a SO with a hardware ID (this would imply that I would have to deploy the config file on every machine that I'm running the application on, so it's not very suitable; also what happens if we decide to switch to a different scanner in the future). I also know that there are tools for associating a logical name to a Service Object (this would also be an impediment for depolyment as I would have to repeat the process each time I'm changing the machine). 

    Would iterating through the list and attempting a try-catch Open() on the scanner instance returned by POSExplorer's CreateDevice(item) work? 

    Can you guys perhaps suggest a better approach?


    Saturday, March 31, 2012 3:29 AM

All replies

  • I doubt that would work. 

    I believe your best bet would be to setup logical names for each device in the configuration tool for your scanner driver.







    Then you can programmatically call each one as desired by logical name.

    Saturday, March 31, 2012 6:35 PM
  • Thanks for your reply Woodchuk.

    Can you please link me to an example of a configuration? Given that this is OPOS drivers that we're talking about, I assumed the procedure should be different than for Service Objects.

    One more thing:

    What exactly are those items returned by GetDevices()? Classes of devices or connected devices? 


    Saturday, March 31, 2012 8:12 PM
  • unfortunately i dont use datalogic so i dont know.

    you should be able to configure the devices using their software to set up a device.  After that you may need to use Pos For .NET to set logic name.  it depends on the manufacturer configuration software.

    Saturday, March 31, 2012 11:09 PM
  • Datalogic is a tough one. I had one of their scanners, and I couldn't get the OPOS driver to work with POS for .NET.

    The MS scanner similuator is using the sample service object is from the SDK. You can remove the DLL out of the path so it is not confusing with the other devices.

    -Sean / /, Book Author - Pro Guide to WES 7, XP Embedded Advanced, Pro Guide to POS for .NET

    Saturday, March 31, 2012 11:30 PM
  • Well, the thing is that I've managed to communicate with the scanner. Since, at the moment I only have one device, I have no idea what will happen when all 6 devices will be connected. 

    It is still not clear to me whether the items appearing in the getDevices() list are device classes or devices which exists physically. Would there be 6 different items corresponding to my 6 scanners in that list or would there just be one item (namely a device class). In the former case, how do I find out which scanner performed a scan when a DataEvent event is received?

    Shouldn't they have something like a unique-per-scanner ID (just like network cards have MAC addresses)?

    Sunday, April 01, 2012 11:35 AM
  • They would all have the same PnP ID so it is not easy to know which one is which.  In the sample application and POSDM, you would see all 6 devices listed. As Woodchux pointed out, you have to setup unique logical IDs for each device. Then you have to test each one to see which logical ID it goes with.

    -Sean / /, Book Author - Pro Guide to WES 7, XP Embedded Advanced, Pro Guide to POS for .NET

    Sunday, April 01, 2012 5:00 PM
  • Thanks for following this thread, Sean.

    The only problem is that I could not find a tool which sets the LDN field for Datalogic barcode scanners. Is it possible that such an utility is not made available by a provider or am I missing something here? Since you said you worked with a Datalogic device in the past, do you remember whether you were able to identify such a tool?

    Sunday, April 01, 2012 6:36 PM
  • I think there was a tool for it, but I remember it never worked. you should contact Datalogic to get assistance with their products. They might have a tool or instructions to set teh Logical name.

    -Sean / /, Book Author - Pro Guide to WES 7, XP Embedded Advanced, Pro Guide to POS for .NET

    Monday, April 02, 2012 7:08 AM
  • Why you need to identify which exactly is the scanner? You get item barcode... and sell it.
    Monday, April 02, 2012 12:46 PM
  • @ABC07 There will be an ADMIN scanner which will perform check scans and other operations in a live registration system. 

    Anyway, if someone is working with Datalogic's OPOS legacy drivers, do know that I was not able to communicate with more than one scanner in the same time. 

    This is what I've tried:

    1. Connected two identical scanners. Configured them both in USB-OEM mode. This automatically put them in "sleep" by mode (lights off). POSExplorer's getDevices() returned device categories. Whenever I opened and enabled a device of my type ("USBScanner"), one of the two scanners would light up while the other one would still be in sleep mode. This would allow me to scan using just one scanner. The other one was unusuable. I also tried creating two scanner instances using the same device type. This resulted in two objects with different values for GetHashCode(), but they both seemed to have been associated to the same scanner (the active one). Removing the active scanner, would enable the second scanner to work. 

    2. The only way I could get them to work was to set one of them in table mode and the other in hand held mode. But this only works with two scanners. I added a third one and it became unusuable.

    The only working solution I have so far is to use the USB to COM driver (along with setting up the scanner in serial mode). But working with COM ports is a bit messy, if you ask me. From crashes leading to open ports to being forced to assign a name for each of my scanner manually. Only plug and play support is crude and consists of monitoring COM ports (not all of them might be coming from scanners, ofc). 

    So yeah, quite disappointed. I was hoping for a cleaner solution with PnP support and all that. I keep feeling that there's something that I was doing wrong since it does seem impossible to me that they have not sorted out having more than one scanners connected by now. 

    Wednesday, April 04, 2012 8:46 PM
  • 1. Contact Datalogic and ask them if the scanner (SO) can get different name/alias.


    2. Use additional PC to connect at least Admin scanner.

    3. Control the scanner directly via serial port (I suppose the protocol is very simple, mostly data from scanner to PC).

    Thursday, April 05, 2012 7:33 AM
  • I've already went through steps 1 and 3. I'm currently stuck in using the scanner via the USB to COM driver which Datalogic themselves provided.

    I'm using C#'s SerialPort class and I have a problem when I open the port a second time. The test case scenario consists of the following operations (with a certain delay between them): open port, attach data handler, scan (works fine), detach handler, close port, reopen port, scan (fails).

    I've been able to use Putty in serial mode to connect to the device and it works just fine. I am suspecting a possible resource handling issue in C#. Maybe the handle for the resource does not expire when I use Close(), whereas when Putty closes, the whole process is destroyed (which probably triggers resource dealocation as well).

    Has anyone been confronted with this particular problem? 

    I need to mention that I have 3 scanners, a Gryphon and 2 Magellan scanners. The Gryphon works just fine on subsequent port reopen operations. It's just the Magellan scanners that fail.

    Sunday, April 08, 2012 11:24 PM
  • You may call serialPort.Dispose(); like in this page:

    The other syntax for guaranteed port close is this:

    using (SerialPort p = new SerialPort())

    • Edited by ABC07 Monday, April 09, 2012 7:24 AM
    Monday, April 09, 2012 7:24 AM
  • 1. Contact Datalogic and ask them if the scanner (SO) can get different name/alias.


    2. Use additional Tablet PC to connect at least Admin scanner.

    3. Control the scanner directly via serial port (I suppose the protocol is very simple, mostly data from scanner to PC).

    do like that 3 steps,then you will fix it.
    Saturday, October 06, 2012 10:27 AM