System designGuide

Identify barcode scanners by serial number after reconnects

Identify barcode scanners by serial number, bind each reader to the correct application input, and test recovery when COM ports change after reconnects.

LumaSpec Vision11 min read Share on LinkedIn

On this page 10 sections
  1. 01Choose identity first, then discover the current port
  2. 02Distinguish a reader serial number from other identifiers
  3. 03Establish identity through supported discovery
  4. 04Bind logical roles and refuse ambiguous connections
  5. 05Treat reconnects as new acquisition sessions
  6. 06Compare interfaces without assuming identity support
  7. 07Work through a two-reader recovery example
  8. 08Verify recovery and recognize fallback limits
  9. 09Check the requirements before ordering
  10. 10Questions

Two identical barcode readers can exchange operating-system port assignments after a reconnect, even though neither reader has changed its physical position. For a station reading different items at different locations, that can send valid barcode data to the wrong application input. The solution is to separate device identity from its current communication endpoint. You will learn which identifiers to trust, how to bind each reader to a logical role, and how to test recovery without silently swapping inputs.

Choose identity first, then discover the current port

To identify barcode scanners by serial number, your application needs a documented way to obtain each reader's unique serial number. That might come from supported device enumeration, an SDK property, or a documented identification query. The available method depends on the reader and its operating mode.

Store a mapping from that persistent identity to an application role, such as incoming_part or finished_assembly. During each connection session, discover the current communication endpoint and associate it with that identity.

Keep these three concepts separate:

  • Identity: which physical reader is connected.
  • Endpoint: where the application currently communicates with it.
  • Role: which application input should receive its scans.

A COM-port name is an endpoint, not sufficient proof of identity. An SDK device handle may also identify only the current session. Neither should become the permanent key unless the manufacturer's documentation explicitly guarantees the required persistence.

If your application still needs a basic acquisition path, start with USB barcode scanner data capture. Identity binding belongs above that transport layer, rather than being replaced by it.

Distinguish a reader serial number from other identifiers

Several values can look unique during initial commissioning. Their behavior after reconnection is what matters.

Candidate identifier What it identifies Appropriate use Main limitation
Reader serial number A physical reader, when documented as unique and persistent Preferred key for reader-to-role binding May not be exposed through every operating mode
SDK device handle An enumerated device in the current software session Opening a connection and routing current events May change after a service or application restart
COM-port name A current serial endpoint Opening the discovered port Does not establish which reader is attached
USB vendor and product identifiers A device family or interface type Filtering discovery candidates Identical readers commonly share these values
USB location path A connection topology Binding a station position under controlled wiring Moving a cable or hub can change the association
Adapter serial number A USB-to-serial adapter Identifying an adapter-backed connection Does not prove which reader is attached downstream
Network address A current network endpoint Reaching a network-connected reader An address assignment is not permanent device identity

A USB-to-serial adapter deserves particular attention. Its serial number may remain stable while the reader connected to it changes. That can support a deliberately port-based station design, but it is not reader-level identification.

Similarly, a device-instance identifier can contain useful information without being universally persistent. Where no device serial is available, some identifiers depend on connection topology. Check the documented construction and test the actual hardware.

The decoded barcode payload is not reader identity either. Two readers can legitimately scan the same part number, so payload matching cannot establish the source.

Establish identity through supported discovery

Use the manufacturer's supported SDK or the operating system's documented device-enumeration interfaces. Obtain software and documentation only from the manufacturer or its authorized distributors.

On a virtual serial connection, discovery must connect the operating system's device information to the currently assigned port. Do not assume that enumeration order matches physical position, installation order, or ascending port numbers.

A practical discovery sequence is:

  1. Enumerate supported reader interfaces without opening unrelated devices.
  2. Collect the current endpoint and available identity attributes.
  3. If necessary, open a candidate and use its documented identification operation.
  4. Normalize the returned identity according to the documented format.
  5. Reject missing, ambiguous, or duplicate identities.
  6. Resolve the accepted identity to a commissioned application role.

Preserve serial numbers as strings. Leading zeros can be significant. Do not remove punctuation, change case, or trim characters unless the documented format permits that transformation.

Use a scoped identity key when a serial number is only guaranteed unique within a product family. The scope might include the documented device family and identity type. An adapter serial and a reader serial must never share an indistinguishable key format.

If communication itself is uncertain, resolve RS232 barcode scanner connection requirements before diagnosing identity. A silent or incorrectly configured connection cannot provide reliable discovery evidence.

Bind logical roles and refuse ambiguous connections

Commission each role deliberately. Connect or select the intended reader, inspect its reported identity, and confirm its physical position with a controlled test scan. Save the approved association in persistent application configuration.

For example, a station configuration could contain these application-defined values:

role: incoming_part
identity_type: reader_serial
identity_value: 00073184

role: finished_assembly
identity_type: reader_serial
identity_value: 00073185

These are illustrative identity strings, not product specifications. The current COM-port name belongs in a separate runtime record, not in the permanent role definition.

At startup, require exactly one acceptable connection for each required role. Handle other outcomes explicitly:

  • No matching reader: mark the role unavailable and stop accepting its production data.
  • Unknown identity: present it for authorized commissioning; do not assign it automatically.
  • Duplicate identity: refuse automatic binding and investigate the hardware or discovery data.
  • Multiple interfaces for one reader: select the documented acquisition interface rather than counting interfaces as separate readers.

Replacement hardware should require an approved reassignment. Automatically giving the first unknown reader a missing role recreates the original fault under a different name.

Keep a reader configuration backup before changing communication modes. A mode change can alter which interface the host sees and which identity information it can obtain.

Treat reconnects as new acquisition sessions

A reader returning on the same port is not proof that it is the previous reader. Revalidate identity whenever the application opens a new connection, including after transport errors and host restarts.

Use an explicit state sequence:

absent -> discovered -> identity_verified -> role_bound -> ready

Production data should enter the application only in the ready state. On disconnection, invalidate the binding immediately and mark any incomplete acquisition according to the application's loss policy.

Give every opened connection a new session token. Attach that token to callbacks and queued messages. Before accepting an event, check that its token still matches the active connection for the role. This prevents a late callback from an old connection being accepted after reconnection.

Keep trigger requests, barcode records, and transaction identifiers associated with both the role and session. A decoded value arriving late must not complete a newer transaction merely because its text is plausible.

Buffer handling also needs a defined policy. Close obsolete connections, discard incomplete messages, and use documented buffer-clearing behavior where appropriate. Never silently carry an old partial record into a new reader session.

For event-processing design, the guide to barcode scan event handling explains why acquisition callbacks and application updates should remain separate.

Compare interfaces without assuming identity support

Interface choice affects discovery, but it does not prove that a unique reader serial number is accessible. A USB interface is not automatically a virtual COM port, and an Ethernet interface does not establish a particular application protocol.

The fixed code readers category and camera and reader finder help narrow hardware candidates. Confirm the identity API and reconnect behavior before selecting a reader for a multi-input station.

The LS-CRD-0047 is listed with a USB interface and global shutter. Treat it as a candidate for a host-connected installation, subject to verification of its supported communication modes and identity access.

Fixed code readersCompact fixed industrial barcode reader, 1.2 MP, USB 2.0, 60-120 mm reading distance (LS-CRD-0047)LS-CRD-0047
Resolution
Up to 3 MP
Shutter
Global
Interface
USB
$559.00View part

The LS-CRD-0028 is listed with a Fast Ethernet interface and global shutter. For a network-connected design, confirm how the application discovers its identity and associates that identity with its current endpoint.

Fixed code readers2560 x 2048 fixed code reader, 30 fps, 60 codes/s, 8 mm lens (LS-CRD-0028)LS-CRD-0028
Interface
Fast Ethernet
Resolution
5 MP
Sensor format
1/1.7"
Shutter
Global
$920.00View part

Neither listing establishes unique serial-number exposure, SDK event contents, or reconnect timing. Request the relevant documentation and verify those behaviors on the intended configuration.

Check code reader accessories for application requirements, but confirm compatibility for the exact reader. An accessory listing does not establish support for an identity query or communication mode.

Code readers & vision sensorsCode reader accessories

Lens covers, light boards, I/O boxes and modules

30 models · from $39.00

For cables, verify connector pinout, power requirements, interface type, and permitted cable routing. Use the accessories finder to narrow candidates; matching connector appearance alone is not enough.

AccessoriesCables

Camera data, power and I/O cables

401 models · from $22.00

If disconnects happen before identity can be read, investigate scanner power and interface checks. Identity-aware software cannot compensate for an unstable physical connection.

Work through a two-reader recovery example

Assume the incoming-part reader initially appears on COM5 and the finished-assembly reader on COM6. After both reconnect, their endpoints exchange assignments.

A port-based application opens its saved names and silently reverses the inputs. An identity-based application enumerates again, reads the persistent identities, and rebuilds its runtime mapping:

Logical role Commissioned identity Initial endpoint Endpoint after reconnect
Incoming part 00073184 COM5 COM6
Finished assembly 00073185 COM6 COM5

The permanent configuration does not change. Only the current endpoint changes.

Budget recovery time from measured stages rather than assuming an immediate return. A useful planning estimate is:

T_recovery ≈ T_detection + T_open + T_identity + T_setup

For an illustrative case, allow up to 500 ms for discovery polling, 150 ms to open the connection, 250 ms to verify identity, and 100 ms to restore acquisition settings:

T_recovery ≈ 500 + 150 + 250 + 100 = 1,000 ms

These are application assumptions, not reader specifications or guaranteed limits. Measure the stages on the target host, then choose timeouts with margin for observed variation.

During that interval, show the affected role as unavailable. If production cannot tolerate the interruption, define how the station pauses, rejects, or holds the associated item. Automatic reconnection is not automatic recovery of missed scans.

Verify recovery and recognize fallback limits

Test routing with controlled labels at known physical positions. Use distinct payloads for the two positions, and confirm both the reported reader identity and receiving application role. Repeat with the same payload at both readers to prove that routing does not depend on barcode text.

A compact acceptance plan covers these scenarios:

Recovery scenario What to verify
Disconnect the incoming-part reader only The other role remains correctly bound
Disconnect the finished-assembly reader only The missing role cannot receive unrelated data
Disconnect both and reconnect in reverse order Enumeration order does not determine roles
Restart the application with both connected Saved identities rebuild the correct mapping
Restart the documented reader service, if used New session handles do not change logical roles
Restart the host Discovery completes before acquisition is enabled

For example, 6 scenarios repeated 5 times give 30 recovery cycles. Checking 2 roles per cycle gives 60 role checks. Taking 2 test reads per role check produces 120 test reads.

Record wrong-role assignments, missing reads, duplicate deliveries, and recovery duration separately. Observing no wrong-role assignments in this test is useful evidence, not proof that every future reconnect will behave correctly.

Serial-number binding is not the usual answer when the workflow intentionally follows a socket rather than a physical reader. A controlled topology-based design can be appropriate there, provided cable movement and reader replacement are governed procedures.

If the reader exposes no persistent identity, do not manufacture one from enumeration order. Consider documented topology binding, an identification-capable adapter with clearly stated limits, or hardware with documented reader-level identification.

Check the requirements before ordering

Use this short checklist to turn the software requirement into a purchasing and commissioning decision:

  • Identity source documented: establish whether the value identifies the reader, adapter, or interface.
  • Uniqueness scope known: confirm how duplicate or blank identities are handled.
  • Operating mode verified: test identity access in the exact mode used for production capture.
  • Role mapping persistent: store commissioned identity separately from the current endpoint.
  • Reconnect behavior defined: block acquisition until identity and role have been revalidated.
  • Replacement controlled: require an approved update rather than automatic reassignment.
  • Acceptance evidence recorded: retain routing checks and timing observations for the deployed configuration.

If identity access or cable compatibility remains uncertain, send the required role mapping, interface mode, and reconnect test plan through applications support. For an established design, use the cable and extras configurator to complete the connection requirements without treating a port assignment as device identity.

Questions

Can I keep two readers assigned correctly by saving their COM-port names?

No. A port name identifies a communication endpoint, while the application needs evidence of which physical reader occupies it. Discover the current endpoint, obtain a documented persistent identity, and resolve that identity to a commissioned role before accepting production scans.

Does every USB barcode reader expose its serial number?

Not necessarily. Some USB connections expose identity information through supported enumeration, while other operating modes require an SDK or documented device query. Confirm that the returned value identifies the reader itself and remains available in the communication mode your application will actually use.

Can a USB-to-serial adapter serial number identify the reader?

It can identify the adapter, which may be useful when the application role intentionally belongs to a fixed connection. It cannot independently detect replacement of the reader attached downstream. Document that limitation and control cable movement and reader replacement as part of commissioning.

What should the application do if two readers report the same identity?

Treat the affected roles as ambiguous and stop automatic assignment. Check whether discovery returned an adapter identity, a shared placeholder, or multiple interfaces from one reader. Use documented identification methods and obtain manufacturer support if distinct physical readers still report the same supposedly unique value.

How should a replacement reader inherit an existing application input?

Require explicit approval to associate the replacement identity with the existing role. Verify its operating mode and acquisition settings, then repeat routing and reconnect tests. Retain the former association in configuration history so maintenance can explain when and why the physical reader changed.