Skip to content

Add Rust SCPI example for Thorlabs PMxxx power meters on Linux (USBTMC) - #51

Closed
youziLab wants to merge 1 commit into
Thorlabs:mainfrom
youziLab:rust-pmxxx-usbtmc-example
Closed

Add Rust SCPI example for Thorlabs PMxxx power meters on Linux (USBTMC)#51
youziLab wants to merge 1 commit into
Thorlabs:mainfrom
youziLab:rust-pmxxx-usbtmc-example

Conversation

@youziLab

@youziLab youziLab commented Sep 1, 2026

Copy link
Copy Markdown

Rust port of the C++ NI-VISA SCPI example (C++/Thorlabs PMxxx Power Meters/scpi/PMXXX_SCPI.cpp)
that talks to the Linux kernel USBTMC driver (/dev/usbtmc*) directly instead of NI-VISA:

  • device auto-discovery by Thorlabs USB vendor id (0x1313) via sysfs
  • blocking one-shot acquisition (MEASure?) with temperature readout
  • continuous non-blocking acquisition (INIT:CONT + FETC:BINA?) following the
    manual's "Continuous Measurements" flow
  • USB488 Remote Enable (REN) handling required by PM100D2/PM100D3 handheld meters,
    mirroring the NI-VISA session ritual (ioctl via the nix crate)
  • udev rule for user-space access to Thorlabs usbtmc devices

Includes a README with build/run instructions and firmware quirks observed on a
PM100D2 (fw 1.0.7); items not further verified are marked as reference-only.

Rust port of the C++ NI-VISA SCPI example (PMXXX_SCPI.cpp) that talks to
the Linux kernel USBTMC driver (/dev/usbtmc*) directly instead of NI-VISA:

- device auto-discovery by Thorlabs USB vendor id (0x1313) via sysfs
- blocking one-shot acquisition (MEASure?) with temperature readout
- continuous non-blocking acquisition (INIT:CONT + FETC:BINA?) following
  the manual's "Continuous Measurements" flow
- USB488 Remote Enable (REN) handling required by PM100D2/PM100D3 handheld
  meters, mirroring the NI-VISA session ritual (ioctl via the nix crate)
- udev rule for user-space access to Thorlabs usbtmc devices

Includes a README with build/run instructions and firmware quirks
observed on a PM100D2 (fw 1.0.7); items not further verified are marked
as reference-only.
@youziLab
youziLab force-pushed the rust-pmxxx-usbtmc-example branch from fdaeadc to 4251dbc Compare September 1, 2026 05:38
@gboedecker

Copy link
Copy Markdown
Contributor

Thank you very much for your contribution! We appreciate the time and effort you put into this work. Since Rust is not currently a supported language within our example repository, we have decided not to proceed with this change at this time.

That said, we believe this example could be valuable for some customers. We therefore plan to add a link to your repository to our internal notes as a reference for Linux and Rust users.

@gboedecker gboedecker closed this Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants