Coder Social home page Coder Social logo

jridgewell / asdbctl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from juliuszint/asdbctl

0.0 0.0 0.0 1.02 MB

Small command line utility to get/set the brightness of Apple Studio Displays from Linux

License: MIT License

Rust 38.36% JavaScript 61.64%

asdbctl's Introduction

Apple Studio Display Brightness Control

A small command line utility to get or set the brightness level for Apple Studio Displays in node.

import * as asdbctl from "asdbctl";

// Check if a Studio Display is connected
asdbctl.hasDisplay();

// Get the current brightness as a percent.
console.log(asdbctl.getBrightness()); // 100

//Set the brightness as a percent.
console.log(asdbctl.setBrightness(50));

console.log(asdbctl.getBrightness()); // 50

Background

Dumping the USB traffic on macOS with Wireshark and setting the proper filters will show the USB Control transfers to set the brightness::

bmRequestType: 0x21
bRequest     : 0x9
wValue       : 0x0301
wIndex:      : 0x000c
wLength      : 0x7

with this data package when setting it to the minimum brightness value::

[ 0x01, 0x90, 0x01, 0x00, 0x00, 0x00, 0x00 ]

The 0x90 and 0x01 are the brightness value encoded with the least significant byte first (LSB).

Its possible to operate the Studio Display in 3 different USB configurations and Linux will use the first. This means that the USB interface number for controlling the brightness is not 0xc (extracted from the dump) but 0x7.

asdbctl's People

Contributors

jridgewell avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.