Show HN: Tamron Lens Utility Alternative on Linux

xiaoyu20061 pts0 comments

GitHub - yikerman/tamron-lens-control: Linux-only CLI for viewing and changing settings on compatible Tamron lenses. · GitHub

/" data-turbo-transient="true" />

Skip to content

Type / to search

Sign in<br>Sign upAppearance settings

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

yikerman

tamron-lens-control

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

master

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>5 Commits<br>5 Commits

.github/workflows

.github/workflows

src

src

.gitignore

.gitignore

AGENTS.md

AGENTS.md

Cargo.lock

Cargo.lock

Cargo.toml

Cargo.toml

LICENSE

LICENSE

PROTOCOL.md

PROTOCOL.md

README.md

README.md

TODO.md

TODO.md

View all files

Repository files navigation

Tamron Lens Control

tlc is a Linux-only command-line utility for viewing and changing settings on compatible Tamron lenses. It aims to reproduce what the official Tamron Lens Utility has to offer on Linux.

Disclaimer

No affiliation tamron-lens-control is an independent, community-driven project and is not affiliated with, endorsed by, or sponsored by Tamron Co., Ltd. "Tamron" is a trademark of its respective owner, used here only to identify compatible products.

No warranty tamron-lens-control is licensed under GNU GPL v3 or later and comes with absolute zero warranty. While I do hope it provides help, on using this software, you accept that your lens may brick, bounce away, shoot around the room like a frightened sparrow or leave the Earth and the Solar System. See LICENSE.

Install

Build and install from this repository with a recent Rust toolchain:

cargo install --path .

Connect the lens directly over USB, then confirm that tlc can see it:

tlc devices<br>tlc info

When several lenses are connected, select one by the serial number or port shown by tlc devices:

tlc --device SERIAL info<br>tlc --device /dev/ttyUSB0 info

Use

## Each command connects to the lens, performs one action, and disconnects.<br>## Note that a lens may support only a subset of them.

# View focus ring settings<br>tlc ring get

# Reverse the focus ring direction<br>tlc ring set direction reverse

# View Focus Set Button and Custom Switch assignments<br>tlc button get

# Assign Focus Preset to the Focus Set Button<br>tlc button set focus function focus-preset

## some more.. see tlc --help

# Fine-tune autofocus accuracy<br>tlc focus-calibration set 2

Run tlc --help or add --help after any command for available settings, accepted values, and lens-specific requirements.

Place -v before the command to show each operation sent to the lens, and -vv to also print all raw transmitted and received bytes in hexadecimal.

Backups

Back up all current settings before making extensive changes:

tlc settings save my-lens.tlc<br>tlc settings load my-lens.tlc

Backup files can be restored only to the same lens model.

Linux Driver Setup

If the lens appears in lsusb but not in tlc devices, Linux may need to be<br>told to use the cp210x USB serial driver for it.

One-Time Setup

Use these commands to test the driver setup immediately:

sudo modprobe cp210x<br>echo 2cd1 0002 | sudo tee /sys/bus/usb-serial/drivers/cp210x/new_id<br>echo 2cd1 0005 | sudo tee /sys/bus/usb-serial/drivers/cp210x/new_id

Reconnect the lens and check for its serial port:

tlc devices

If /dev/ttyUSB0 exists but cannot be opened, grant your current user temporary access:

sudo setfacl -m u:"$USER":rw /dev/ttyUSB0

Persistent Setup

Create one udev rule that registers the Tamron USB IDs and grants the active desktop user access whenever a compatible lens is connected:

sudoedit /etc/udev/rules.d/70-tamron-lens.rules

Add these lines:

/sys/bus/usb-serial/drivers/cp210x/new_id'"<br>ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", DRIVER=="", ATTRS{idVendor}=="2cd1", ATTRS{idProduct}=="0005", RUN+="/bin/sh -c '/sbin/modprobe cp210x && echo 2cd1 0005 > /sys/bus/usb-serial/drivers/cp210x/new_id'"<br>SUBSYSTEM=="tty", ATTRS{idVendor}=="2cd1", ATTRS{idProduct}=="0002", TAG+="uaccess"<br>SUBSYSTEM=="tty", ATTRS{idVendor}=="2cd1", ATTRS{idProduct}=="0005", TAG+="uaccess"">ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", DRIVER=="", ATTRS{idVendor}=="2cd1", ATTRS{idProduct}=="0002", RUN+="/bin/sh -c '/sbin/modprobe cp210x && echo 2cd1 0002 > /sys/bus/usb-serial/drivers/cp210x/new_id'"<br>ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_interface", DRIVER=="", ATTRS{idVendor}=="2cd1", ATTRS{idProduct}=="0005", RUN+="/bin/sh -c '/sbin/modprobe cp210x && echo 2cd1 0005 > /sys/bus/usb-serial/drivers/cp210x/new_id'"<br>SUBSYSTEM=="tty", ATTRS{idVendor}=="2cd1", ATTRS{idProduct}=="0002", TAG+="uaccess"<br>SUBSYSTEM=="tty", ATTRS{idVendor}=="2cd1",...

lens tamron attrs 2cd1 cp210x serial

Related Articles