Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get tools working on mac without sudo #13

Open
bjcoombs opened this issue Feb 8, 2022 · 27 comments
Open

Get tools working on mac without sudo #13

bjcoombs opened this issue Feb 8, 2022 · 27 comments
Labels
enhancement New feature or request

Comments

@bjcoombs
Copy link

bjcoombs commented Feb 8, 2022

Hi,

Firstly thanks for this. I was able to control my light via command line on mac, but it needs to run via sudo due to the usb libs used currently. I'm able to use the codes you've discovered to turn on/off the light via https://github.com/todbot/hidapitester.

Light On

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

Light Off

hidapitester --vidpid 046D/C900 --open --length 20 --send-output 0x11,0xff,0x04,0x1c

This works without sudo. As far as I can tell udev roles don't exists on mac.

I understand your project is written in python and the other referenced project is written in C. I wanted to post this question here incase anyone else found it helpful.

@phubbard
Copy link

Thanks so much for the two commands! Those are already super useful as shell aliases. Can you share any others that you discover? Bright up/down especially.

@incanus
Copy link

incanus commented Feb 20, 2022

I've managed to hack this library fairly simply to use hidapi on my Mac, without sudo, instead of pyusb. Would anyone be interested in that, and/or would @kharyam be interested in some sort of PR to add it to this project?

The need appears to stem from pyusb/pyusb#208. Unlike @bjcoombs, I wasn't able to get sudo to work on Monterey.

@phubbard
Copy link

I’m interested- can you do a PR?

@kjake
Copy link

kjake commented Mar 7, 2022

Would love this for macOS (Monterey). The G Hub app is slow, and I'd like to have some sort of key binding or at least alias to turn my light on/off instead of having to deal with the Logitech software - as good as it is.

@phubbard
Copy link

phubbard commented Mar 9, 2022

I bodged these together into a working Mac solution - see https://ultracrepidarian.phfactor.net/2022/03/09/controlling-the-logitech-litra-on-macos/ for the writeup. Crude but all that I need.

@kjake
Copy link

kjake commented Mar 11, 2022

Works wonderfully - thanks @phubbard! I used the Shortcuts setup to make the light turn off with ⌘F1 and on with ⌘F2

@incanus
Copy link

incanus commented Mar 12, 2022

I love this @phubbard! Thank you. Honestly, this meets my needs since it's so low-level and simple(r) to edit/maintain, so unless I hear from @kharyam, I'll hold off on a PR for now.

@kharyam kharyam added the enhancement New feature or request label Mar 24, 2022
@kharyam
Copy link
Owner

kharyam commented Mar 24, 2022

I'm a bit late to the party here! @incanus if you're still interested in submitting a PR feel free and I will take a look and try to leverage your work.

@SebaldJ
Copy link

SebaldJ commented May 5, 2022

Hello @phubbard @bjcoombs this is great, thank you. Can i use this on windows?
A first test have no effect.
.\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
Thank for your feedback.

@bjcoombs
Copy link
Author

bjcoombs commented May 5, 2022

@SebaldJ - sorry, don't have a windows machine connected to the light to test. But perhaps you don't need this work around, have you tried the scripts found in this repo, rather than hidapitester?

Actually, second though, does hidapitester list the light as existing in your system. Try something like this:

hidapitester --list

does Logi - Litra Glow show up in the list of connected devices?

@SebaldJ
Copy link

SebaldJ commented May 5, 2022

@bjcoombs yes, the device shows in the list, but without name:
046D/C900: -

@bjcoombs
Copy link
Author

bjcoombs commented May 5, 2022

@SebaldJ the command you pasted earlier is to turn the light on. Are you able to turn the light on by hand, and issue the second command to turn it off?

I'm not sure of the security implications of running this tool in windows, but perhaps it's not configured properly, for it not to get the full device names when issuing the list command, might flag that the device isn't responding back to the command line tool as expected. Do you have other devices with a full name in the list command?

@SebaldJ
Copy link

SebaldJ commented May 5, 2022

@bjcoombs no effect, as administrator or not, and when i manual turned the device on, and run the command for off the light:

.\hidapitester.exe --vidpid 046D/C900 --open --length 20 --send-output 0x11,0xff,0x04,0x1c
Opening device, vid/pid: 0x046D/0xC900
Writing output report of 20-bytes...wrote -1 bytes:
 11 FF 04 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Closing device

Strange, then all other devices are listet with name.

056D/405F: EIZO corporation - EIZO USB HID Monitor
0B0E/245E: (null) - Jabra Link 370
0B0E/245E: (null) - Jabra Link 370
0B0E/245E: (null) - Jabra Link 370
04F3/0000: (null) - (null)
04F3/0000: (null) - (null)
04F3/0000: (null) - (null)
046D/C900:  -
046D/C52B: Logitech - USB Receiver
0B0E/245E: (null) - Jabra Link 370
046D/C900:  -
046D/C52B: Logitech - USB Receiver
046D/C232: (null) - (null)
04F3/2398: ELAN - Touchscreen
046D/C52B: Logitech - USB Receiver
04F3/2398: ELAN - Touchscreen
046D/C52B: Logitech - USB Receiver
04F3/2398: ELAN - Touchscreen
046D/C52B: Logitech - USB Receiver
04F3/2398: ELAN - Touchscreen
046D/C52B: Logitech - USB Receiver
046D/C52B: Logitech - USB Receiver
046D/085E: (null) - Logitech BRIO
046D/C52B: Logitech - USB Receiver
.\hidapitester.exe --vidpid 046D/C900 --list-detail
046D/C900:  -
  vendorId:      0x046D
  productId:     0xC900
  usagePage:     0x000C
  usage:         0x0001
  serial_number:
  interface:     -1
  path: \\?\hid#vid_046d&pid_c900&col01#8&11f83373&f&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}

046D/C900:  -
  vendorId:      0x046D
  productId:     0xC900
  usagePage:     0xFF43
  usage:         0x0202
  serial_number:
  interface:     -1
  path: \\?\hid#vid_046d&pid_c900&col02#8&11f83373&f&0001#{4d1e55b2-f16f-11cf-88cb-001111000030}

@gpailler
Copy link

gpailler commented Sep 20, 2022

@SebaldJ, --usagePage ff43 should be added on Windows to properly drive the light as described on this post.
I wrote a Powershell script to drive the light on Windows: https://gist.github.com/gpailler/9e9725b022923ec69dfd8190da97236b

@SebaldJ
Copy link

SebaldJ commented Sep 20, 2022

@gpailler thank you for the PS script, its works wonderfully under Windows 11. Thank you! 👍 😊
here my blog post https://www.dertechblog.de/2022/09/controlling-the-logitech-litra-on-windows/

@cstromme
Copy link

cstromme commented Feb 7, 2023

How would I get to set a specific temperature here? I see @phubbard's list of commands (2700k, 3200k, and 6500k), but I'm unsure on how I would convert to the right input for something like for instance 3400k, or 4200k.

@phubbard
Copy link

phubbard commented Feb 7, 2023

I wrote a python script to generate those. Let me look for it tonight, I don't have it on the work machine.

@statico
Copy link

statico commented Feb 8, 2023

Is there a way to read settings? I'd love to create a little UI similar to https://github.com/kharyam/litra-driver

image

@phubbard
Copy link

phubbard commented Feb 9, 2023 via email

@darrenpmeyer
Copy link

Thanks to @SebaldJ and the work done here by @kharyam, I was able to create a Python script and Alfred workflow for macOS (works with Intel and M1/M2) that uses @SebaldJ's path (a separate binary to do the USB comms, since pyusb has issues on macOS) -- thank you both!

It's here: https://github.com/darrenpmeyer/alfred-litra if you want to see what I did (python bit is in workflow/hid-litra.py

@phubbard
Copy link

@statico does @darrenpmeyer's script work for you? If not, I can dig for my code or modify his to emit all of the color temp numbers. Honestly, his code is lovely, and if you can, just run his Python.

@christophmuellerorg
Copy link

christophmuellerorg commented Mar 21, 2023

I got my lights (Litra Beam) today and wanted to be able to control them with my streamdeck on windows - here is a quick and dirty port to use the hidapi instead which seems to work well on Windows without the need to use zadig - and all my changes through the command line utility directly get picked up by the logitech software which continues to work. The same approach also works on OS X, just install hidapi with pip and you get control without sudo.

@phubbard
Copy link

phubbard commented Jul 31, 2023 via email

@Elektrode
Copy link

I did find the script. It’s a bit ugly, since I didn’t intend to reuse it. Let me clean up the output a bit - I assume what you need is the command string to create aliases for various color temps?

Hi, Paul. Thanks for getting back to me! Yes, that would be great. In the meantime, I was able to divine other color temperatures by adding 2 and 12 to the last two numbers, respectively, on the color temperature lines you had already listed in your script. I believe I found somewhere around 4K-5K with 18,92.

@phubbard
Copy link

Here's the code (no dependencies - should run in any python3) and the results:

https://gist.github.com/phubbard/0046845978a2700650750b357bca0dc6

@Elektrode
Copy link

Elektrode commented Jul 31, 2023

Here's the code (no dependencies - should run in any python3) and the results:

https://gist.github.com/phubbard/0046845978a2700650750b357bca0dc6

Thanks, Paul. This is exactly what I was looking for!

@kharyam
Copy link
Owner

kharyam commented Mar 7, 2024

Just a heads up that I've released a go version of this application , a single native executable for the cli and ui. It uses hidapi so sudo is no longer needed. Let me know if you can give it a test!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests