Skip to content

Commit

Permalink
Change "ctrl_length" variable name to "ctrl_data" for control writes
Browse files Browse the repository at this point in the history
This is indeed the right data type, the length being read from the
actual bytearray data. This misunderstanding led to #10.
  • Loading branch information
MayeulC committed Jun 11, 2017
1 parent 5b24642 commit 3a5a7c5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ratctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def __init__(self):
self.ctrl_value = 0
self.ctrl_index = 0
self.ctrl_length = 0
self.ctrl_data = b''
self.currentDevice = {}
self.initiate()

Expand Down Expand Up @@ -154,7 +155,7 @@ def sendDpi(self, dpi):
self.ctrl_request_type = 0x40
self.ctrl_request = 145
self.ctrl_index = 115
self.ctrl_length = b''
self.ctrl_data = b''
for mode in range(0, 4):
for axis in range(0, 2):
self.ctrl_value = 0x1000 * (mode + 1)
Expand All @@ -174,15 +175,15 @@ def sendMode(self, Mode):
self.ctrl_request_type = 0x40
self.ctrl_request = 145
self.ctrl_index = 116
self.ctrl_length = b''
self.ctrl_data = b''
self.ctrl_value = 0x1000 * (Mode + 1)
self.controlWrite()

def resetDpi(self):
self.ctrl_request_type = 0x40
self.ctrl_request = 145
self.ctrl_index = 115
self.ctrl_length = b''
self.ctrl_data = b''
self.ctrl_value = 0x0000
# Reset packet.
self.controlWrite()
Expand All @@ -208,7 +209,7 @@ def controlWrite(self):
self.handle.controlWrite(self.ctrl_request_type,
self.ctrl_request,
self.ctrl_value, self.ctrl_index,
self.ctrl_length)
self.ctrl_data)
except:
self.hasHandle = 0

Expand Down

0 comments on commit 3a5a7c5

Please sign in to comment.