Categories
Computer science programming utilities

Controlling the Logitech Litra on MacOS

Recently I bought a USB-C connected diffused light for Zoom calls, the Logitech Litra Glow. The hardware is excellent, but the control software, Logitech GHub, is horrible. Intrusive permissions, auto start, auto updater, laggy UI, just a hard no. The light has buttons on the back to control it, but since mine is next to the camera it looks odd when I’m reaching over and let’s face it, I’m a programmer and love solving small problems with code. Let’s find a way.

Some searching found a Linux app on Github, but the USB library for MacOS required sudo access which adds hassle. There’s an issue and discussion on the topic, which led me to hidapitester, which doesn’t require root access to run.

Goals

I want menu bar control, simplified – light on and off, one or two brightness levels. Basically make it easy to use as I hop on and off calls. Here’s what I came up with, hopefully it’s helpful for you too.

Installation and configuration

  1. Install hidapitester
  2. Add shell aliases to control the light
  3. Tweak color temp and brightness values to your liking
  4. Add Shortcuts to drive the shell aliases from the GUI

Install hidapitester

Grab the source or binary from the project GitHub page. Copy it into /usr/local/bin and then, due to app signing requirements, you’ll need to approve its use from the Finder.

open /usr/local/bin

Right click on hidapitester and select Open

On the warning dialog, select Open.

The binary is now flagged as OK; you only have to do this once.

Add shell aliases

The default shell is now zsh so let’s use that. I also use and like oh-my-zsh, so my aliases are in /Users/phubbard/.oh-my-zsh/custom/aliases.zsh

Using the magic payloads from the Github issue, we define a base function _hid that invokes hidapitester with the full path and identifiers. We then build on that to add a selection of color temps and brightness levels.

function _hid() {
  /usr/local/bin/hidapitester --vidpid 046D/C900 --open --length 20 --send-output $1
}
# 2/17/22 Litra Glow aliases from https://github.com/kharyam/litra-driver/issues/13
function light() {
  _hid 0x11,0xff,0x04,0x1c,0x01
}
function dark() {
  _hid 0x11,0xff,0x04,0x1c
}
# ~10%
function glow(){
  _hid 0x11,0xff,0x04,0x4c,0x00,20
}
# ~20%
function dim(){
  _hid 0x11,0xff,0x04,0x4c,0x00,50
}
# tweaking by hand - less than 50%
function normal() {
  _hid 0x11,0xff,0x04,0x4c,0x00,70
}
# ~50%
function medium() {
  _hid 0x11,0xff,0x04,0x4c,0x00,100
}
# 90%
function bright(){
  _hid 0x11,0xff,0x04,0x4c,0x00,204
}
# 2700K
function warmest() {
  _hid 0x11,0xff,0x04,0x9c,10,140
}
# 3200K
function warm() {
  _hid 0x11,0xff,0x04,0x9c,12,128
}
# 6500K
function coldest() {
  _hid 0x11,0xff,0x04,0x9c,25,100
}

You should be able to run any of these from zsh:

exec zsh
light
dark

That might be all you need/want. If so, enjoy!

Add Shortcuts

There’s a few key things to know in order to make this work:

  • You can invoke a shell script or alias by using the Terminal app from Shortcuts
  • You don’t get a login shell, so we need to manually load the aliases for this to work.
  • We also need to use full paths, since the non-login shell has a different PATH set.
  • Once the aliases are loaded, we can chain calls using the && operator.
  • Under the Shortcuts setting, there’s a checkbox for ‘Pin in Menu Bar’ that exposes the Shortcut to your GUI.

Looks like this on the menu bar:

I use these three:

source /Users/phubbard/.oh-my-zsh/custom/aliases.zsh && light && warmest && dim
source /Users/phubbard/.oh-my-zsh/custom/aliases.zsh && dark
source /Users/phubbard/.oh-my-zsh/custom/aliases.zsh && light && warmest && normal

I hope that others find this useful. I’m happy with the result as the code runs in a second or so and has yet to fail.

Litra Beam

A reader tells me that this code also works with the newer Litra Beam if you change the USB IDs in the _hid routine to 046D/C901. Thanks, John!

By Paul Hubbard

Computer engineer from San Diego. Obsessed with hardware, software, timekeeping and elegance.

9 replies on “Controlling the Logitech Litra on MacOS”

Hi Paul, this is wonderful, good job!
On Windows I can use hidapitester but I only get the following output:

.\hidapitester.exe –vidpid 046D/C900 –open –length 20 –send-output 0x11,0xff,0x04,0x1c,0x01

Opening device, vid/pid: 0x046D/0xC900
Writing output report of 20-bytes…wrote -1 bytes:
11 FF 04 1C 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Closing device

Unfortunately without effect.
The vid/pid is also correct under Windows.

Do I need to uninstall the G Hub software and use a different driver?
https://github.com/kharyam/litra-driver is unfortunately not for Windows.

Thanks for your feedback and best regards
Johannes

Like

This is awesome. I”m pretty techy, but even this is beyond me. Any chance you can create a Mac app that does all of the above for me and allows for the controls to “appear” in my menu bar? Love my litra glow’s but HATE the g hub UI and logitech’s gaming devices.

Like

Paul, thank you so much for this! I was looking for a way to control my Litra through a Stream Deck, and this got me almost all the way there!

I used what you provided here to create two shortcuts in the Mac shortcuts app. And from there, set up Stream Deck to run each shortcut. Now I can turn on/off my light with just a simple button press on the Stream Deck. Appreciate you!

Liked by 1 person

So amazing. Worked like a charm. Ended up making my own ~/.lightfunc and sourcing that from my zprofile, but otherwise, followed the instructions and it worked great. You are a lifesaver. Now to see if I can get it to run automatically when I open zoom.

Liked by 1 person

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.