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

fixing LED and rumble report in hidraw mode #154

wants to merge 1 commit into
base: master
Changes from all commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.


Just for now

fixing LED and rumble report in hidraw mode

  • Loading branch information...
PatrickHussey committed Aug 18, 2018
commit 4453e40f33bf519f05ebe72b58bd52d3e193665d
@@ -4,6 +4,7 @@

from io import FileIO
from time import sleep
import zlib

from evdev import InputDevice
from pyudev import Context, Monitor
@@ -62,9 +63,30 @@ def read_feature_report(self, report_id, size):

return fcntl.ioctl(self.fd, op, bytes(buf))

def write_report(self, report_id, data):
hid = bytearray((report_id,))
self.fd.write(hid + data)
def write_report(self, report_id, report):
Send a feature report.
tmp = [0]*79
tmp[:7]= [0xa2, 0x11, 0xC0, 0x00, 0xff, 0x00, 0x00]
tmp[7] = report[5] #rumble weak
tmp[8] = report[6] #rumble strong
tmp[9] = report[7] #red
tmp[10] = report[8] #green
tmp[11] = report[9] #blue
tmp[12] = report[10] # Time to flash bright (255 = 2.5 seconds)
tmp[13] = report[11] # Time to flash dim (255 = 2.5 seconds)

buf = bytearray(tmp)

crc = zlib.crc32(bytes(buf[:(len(buf)-4)])) & 0xffffffff

buf[len(buf)-4] = chr(crc & 0xFF)
buf[len(buf)-3] = chr((crc & 0xFF00) >> 8)
buf[len(buf)-2] = chr((crc & 0xFF0000)>>16)
buf[len(buf)-1] = chr((crc & 0xFF000000)>>24)


def close(self):
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.