Skip to content

Commit

Permalink
Use the long form status CMD for GC
Browse files Browse the repository at this point in the history
  • Loading branch information
darthcloud committed Jul 26, 2022
1 parent 87585c5 commit b1a7d94
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions notes/poll.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
identity_resp = namedtuple('identity_resp', 'id info')
status_resp = namedtuple('status_resp', 'buttons x_axis y_axis')
dol_status_resp = namedtuple('dol_status_resp', 'buttons x_axis y_axis cx_axis cy_axis l_trigger r_trigger')
dol_full_status_resp = namedtuple('dol_full_status_resp', 'buttons x_axis y_axis cx_axis cy_axis l_trigger r_trigger a_press b_press')

RED='\x1b[1;91m'
GREEN='\x1b[1;92m'
Expand All @@ -42,6 +43,7 @@
READ = 0x02
WRITE = 0x03
DOL_STATUS = 0x40
DOL_FULL_STATUS = 0x43
WB_INIT = 0x4E

MOUSE = 0x02
Expand Down Expand Up @@ -92,7 +94,10 @@
('cx_axis', [bmap('CX',0xFF,YELLOW)]),
('cy_axis', [bmap('CY',0xFF,YELLOW)]),
('l_trigger', [bmap('AL',0xFF,LGRAY)]),
('r_trigger', [bmap('AR',0xFF,LGRAY)])])}
('r_trigger', [bmap('AR',0xFF,LGRAY)]),
('a_press', [bmap('A',0xFF,CYAN)]), # A & B pressure only work with DS5 prototype (dev kit) controllers
('b_press', [bmap('B',0xFF,RED)]),
])}

class Bus(Bus):
def identify(self):
Expand Down Expand Up @@ -129,8 +134,8 @@ def status(self, system):
reply = self.bridge.write(bytes([STATUS]), 4)[1]
return status_resp._make(struct.unpack('>H2b', reply))
elif system == DOL:
reply = self.bridge.write(struct.pack(">BH", DOL_STATUS, 0x0300), 8)[1]
return dol_status_resp._make(struct.unpack('>H6B', reply))
reply = self.bridge.write(struct.pack(">BH", DOL_FULL_STATUS, 0x0000), 10)[1]
return dol_full_status_resp._make(struct.unpack('>H8B', reply))
else:
print("Unknown system ID: {}".format(system))
sys.exit()
Expand Down

0 comments on commit b1a7d94

Please sign in to comment.