diff options
author | elupus <elupus@xbmc.org> | 2011-04-16 10:30:35 +0200 |
---|---|---|
committer | elupus <elupus@xbmc.org> | 2011-04-19 20:18:50 +0200 |
commit | c8cff7425c01c50309744ee9f3cb8159ac7c377c (patch) | |
tree | 3cfeb64a18470827a2255afc5e592b741050a525 /tools/EventClients | |
parent | 59f2e8fe02a96f3be5845f724361b8163bb0db0a (diff) |
fixed: make sure analog buttons are considered when deciding idle time for sixaxis
Diffstat (limited to 'tools/EventClients')
-rwxr-xr-x | tools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py | 5 | ||||
-rw-r--r-- | tools/EventClients/lib/python/ps3/sixaxis.py | 9 |
2 files changed, 10 insertions, 4 deletions
diff --git a/tools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py b/tools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py index d956c10d95..0000163aa9 100755 --- a/tools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py +++ b/tools/EventClients/Clients/PS3 Sixaxis Controller/ps3d.py @@ -165,7 +165,10 @@ class PS3SixaxisThread ( StoppableThread ): if not data: continue - (bflags, psflags, pressure) = sixaxis.process_input(data, self.xbmc, toggle_mouse) + (bflags, psflags, pressure, analog) = sixaxis.process_input(data, self.xbmc, toggle_mouse) + + if analog: + self.reset_timeout() if psflags: self.reset_timeout() diff --git a/tools/EventClients/lib/python/ps3/sixaxis.py b/tools/EventClients/lib/python/ps3/sixaxis.py index 04eff7ba3c..c3cacb6c09 100644 --- a/tools/EventClients/lib/python/ps3/sixaxis.py +++ b/tools/EventClients/lib/python/ps3/sixaxis.py @@ -129,11 +129,11 @@ def read_input(isock): def process_input(data, xbmc=None, mouse_enabled=0): if len(data) < 3: - return (0, 0, 0) + return (0, 0, 0, False) # make sure this is the correct report if struct.unpack("BBB", data[0:3]) != (0xa1, 0x01, 0x00): - return (0, 0, 0) + return (0, 0, 0, False) if len(data) >= 48: v1 = struct.unpack("h", data[42:44]) @@ -186,17 +186,20 @@ def process_input(data, xbmc=None, mouse_enabled=0): xval += sumx[i] yval += sumy[i] + analog = False axis = struct.unpack("BBBB", data[7:11]) if xbmc: for i in range(4): config = axismap_sixaxis[i] axis_amount[i] = send_singleaxis(xbmc, axis[i], axis_amount[i], config[0], config[1], config[2]) + if axis_amount[i] != 0: + analog = True # send the mouse position to xbmc if mouse_enabled == 1: xbmc.send_mouse_position(xval/num_samples, yval/num_samples) - return (bflags, psflags, pressure) + return (bflags, psflags, pressure, analog) def send_singleaxis(xbmc, axis, last_amount, mapname, action_min, action_pos): amount = normalize_axis(axis, 0.30) |