展示 HN:Linux 上的腾龙镜头实用程序替代方案
Show HN: Tamron Lens Utility Alternative on Linux

原始链接: https://github.com/yikerman/tamron-lens-control

**tlc** 是一款独立的、由社区驱动的 Linux 专用命令行工具,旨在复制腾龙(Tamron)官方镜头软件的功能。它允许用户查看并修改兼容腾龙镜头的设置,包括对焦环方向、按键分配以及自动对焦校准。 **主要内容:** * **兼容性:** 使用 Rust 构建,通过 USB 直接连接。本项目与腾龙(Tamron Co., Ltd.)无关,也未获得其认可。 * **使用方法:** 该工具通过独立命令运行(例如 `tlc ring get`,`tlc settings save`)。强烈建议用户在进行任何更改前备份原有设置。 * **设置:** 成功运行可能需要配置 `cp210x` USB 串口驱动程序,并设置 `udev` 规则以确保正确的设备访问权限。 * **局限性:** 该软件不提供任何担保。目前尚不支持固件更新等功能。 由于这是第三方项目,用户应谨慎操作以避免潜在的硬件问题。如需详细的操作说明和故障排除,请使用 `--help` 参数或查阅项目文档。

Hacker News 最新 | 过往 | 评论 | 提问 | 展示 | 招聘 | 提交 登录 Show HN: Linux 平台的腾龙镜头实用程序替代方案 (github.com/yikerman) 6 分,由 xiaoyu2006 发布于 1 小时前 | 隐藏 | 过往 | 收藏 | 讨论 | 帮助 指南 | 常见问题 | 列表 | API | 安全 | 法律 | 加入 YC | 联系 搜索:
相关文章

原文

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.

  • 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.

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

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

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

tlc --device SERIAL info
tlc --device /dev/ttyUSB0 info
## Each command connects to the lens, performs one action, and disconnects.
## Note that a lens may support only a subset of them.

# View focus ring settings
tlc ring get

# Reverse the focus ring direction
tlc ring set direction reverse

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

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

## some more.. see tlc --help

# Fine-tune autofocus accuracy
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.

Back up all current settings before making extensive changes:

tlc settings save my-lens.tlc
tlc settings load my-lens.tlc

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

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

Use these commands to test the driver setup immediately:

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

Reconnect the lens and check for its serial port:

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

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

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:

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'"
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'"
SUBSYSTEM=="tty", ATTRS{idVendor}=="2cd1", ATTRS{idProduct}=="0002", TAG+="uaccess"
SUBSYSTEM=="tty", ATTRS{idVendor}=="2cd1", ATTRS{idProduct}=="0005", TAG+="uaccess"

Reload the rules, then unplug and reconnect the lens:

sudo udevadm control --reload-rules
# reconnect
tlc devices && tlc info
getfacl /dev/ttyUSB0

For SSH or a headless system, uaccess may not apply. Check the device group:

stat -c '%G' /dev/ttyUSB0

If it reports dialout, add your user to that group and log out completely:

sudo usermod -aG dialout "$USER"

Note that group membership grants access to every device owned by dialout, not only the lens.

  • Keep the lens connected until a command finishes.
  • Review a setting with its get command before changing it.
  • Use settings save before loading another backup or performing a reset.
  • Lens firmware updates and online firmware checks are not supported yet (see TODO.md).
联系我们 contact @ memedata.com