Linux driver for agan x220 / x230 fhd mod
Requires nodejs, node-hid and inotifywait.
Usage : while inotifywait -qq -e modify /sys/class/backlight/acpi_video0/actual_brightness ; do ./setbrightness.js; done
Linux driver for agan x220 / x230 fhd mod
Inspired by the Linux
requires a few Python components (pip install x)
#script that changes brightness on 51NB thinkpad X230 X330 FHD 13.3" LCD modification
#detects changes in Windows system brightness and sends a command to the LCD driver
#change vendor_id and product_ID to fit your hardware device under Device Manager->Human Interface Devices if it doesn't work, also double check soldering
#also turns off monitor on minimum setting
import subprocess
import pywinusb.hid as hid
import wmi
import win32gui
import win32con
import time
from os import getpid, system
from threading import Timer
screenOff = "asd"
def sample_handler(data):
print("Raw data: {0}".format(data))
#turn off LCD
def turnoffLCD():
def force_exit():
pid = getpid()
t = Timer(1, force_exit)
t.start()
SC_MONITORPOWER = 0xF170
win32gui.SendMessage(win32con.HWND_BROADCAST, win32con.WM_SYSCOMMAND, SC_MONITORPOWER, 2)
t.cancel()
#sends HID command between 0-255 to USB LCD controller
def updateBrightness(brightnesslevel):
filter = hid.HidDeviceFilter(vendor_id = 0x10C4, product_id = 0x83CE)
hid_device = filter.get_devices()
device = hid_device[0]
device.open()
device.set_raw_data_handler(sample_handler)
out_report = device.find_feature_reports()[0]
cmd = (0,
brightnesslevel,
)
buffer = [0x00] * 2
i = 0
for x in cmd:
buffer[i] = x
i += 1
out_report.set_raw_data(buffer)
out_report.send()
device.close()
#detects changes in brightness
def brightnessChangeDetect():
global screenOff
c = wmi.WMI(namespace='wmi')
watcher = c.WmiMonitorBrightnessEvent.watch_for(
notification_type="Modification",
delay_secs=1
)
event_happened = watcher()
brightnesslevel = int((event_happened.Brightness)*2.5)
if brightnesslevel > 0:
screenOff = 0
if brightnesslevel == 0 and screenOff == 0:
turnoffLCD()
time.sleep(1)
screenOff = 1
updateBrightness(brightnesslevel)
#main program
while True:
brightnessChangeDetect()
Excuse me, I installed the agan's x230 fhd mod too, but my screen is often black after grub, and I have to use nomodeset kernel command line to get the screen work. But Ubuntu gets really slow after using nomodset. And I have tried a lot of method, all doesn't work. By the way, the screen works fine in Windows. I've tried on Ubuntu 18.04, debian stretch and debian buster, all the same problem. Thank you
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.