Re: Re: Re: [PATCH] HID: sony: Add force feedback support for Dualshock3 USB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> This seems to work, however something is causing the LEDs to go out once
> they have been set. This seems to happen a few seconds after they are set,
> but there does not appear too be USB activity (via usbmon).

I tested this on a real machine (as opposed to VM box), and the LEDs
remain set and do not auto cancel. Suspect host OS was doing something to
device.

There is another bit of weirdness though, when plugged in my Intec
controller slow flashes the LEDs. This is overwritten when I set any LED
through the LED class, but returns to flashing when I clear all LEDs via
the class.

IE. there is no way to turn all the the LEDs off.

The DualShock3/SixAxis behaves slightly differently in that the flashing
does not return when all the LEDs are turn off.

>From some of my earlier investigations I had some notes about LED settings
which might be of help.
--
# \x01                          Header
# \x00\x00\x00\x00\x00          ForceFeedback
(\x00\xfe\x00+<rumble,40=weak,80=strong>
# \x00\x00\x00\x00\x1E          Which LED to enable(LED1..4 << 1, 0x20=none)
# \xff\x27\x10\x00\x32          LED 1 (rate,duty factor
# \xff\x27\x10\x00\x32          LED 2
# \xff\x27\x10\x00\x32          LED 3
# \xff\x27\x10\x00\x32          LED 4
# \x00\x00\x00\x00\x00          Footer

#        * the total time the led is active (0xff means forever)
#        * |     duty_length: how long a cycle is in deciseconds (0 means
"blink really fast")
#        * |     |     ??? (Some form of phase shift or duty_length
multiplier?)
#        * |     |     |     % of duty_length the led is off (0xff means
100%)
#        * |     |     |     |     % of duty_length the led is on (0xff
mean 100%)
#        * |     |     |     |     |
#        * 0xff, 0x27, 0x10, 0x00, 0x32,
--

Attached is a script which works with my Intec, but not with the SixAxis.
Simon
#!/usr/bin/python
#
# Small script to test the rumble on a PS3 gamepad
#

import usb
import time

rumble = 0

busses = usb.busses()
for bus in busses:      
  devices = bus.devices   
  for dev in devices:
    if dev.idVendor == 0x054c and dev.idProduct == 0x0268:
      print "Found RumblePad"
      rumble = dev

if rumble == 0:
  print "RumblePad not found"
  exit(0)

# Get a device handler for the usb device and detach it from the kernel
dh = rumble.open()
dh.detachKernelDriver(0)
dh.claimInterface(0)

#command='\x52\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1E\xff\x27\x10\x00\x32\xff\x27\x10\x00\x32\xff\x27\x10\x00\x32\xff\x27\x10\x00\x32\x00\x00\x00\x00\x00'

# \x01				Header
# \x00\x00\x00\x00\x00		ForceFeedback (\x00\xfe\x00+<rumble,40=weak,80=strong>
# \x00\x00\x00\x00\x1E		Which LED to enable(LED1..4 << 1, 0x20=none)
# \xff\x27\x10\x00\x32		LED 1 (rate,duty factor
# \xff\x27\x10\x00\x32		LED 2
# \xff\x27\x10\x00\x32		LED 3
# \xff\x27\x10\x00\x32		LED 4
# \x00\x00\x00\x00\x00		Footer

#	 * the total time the led is active (0xff means forever)
#	 * |     duty_length: how long a cycle is in deciseconds (0 means "blink really fast")
#	 * |     |     ??? (Some form of phase shift or duty_length multiplier?)
#	 * |     |     |     % of duty_length the led is off (0xff means 100%)
#	 * |     |     |     |     % of duty_length the led is on (0xff mean 100%)
#	 * |     |     |     |     |
#	 * 0xff, 0x27, 0x10, 0x00, 0x32,

print "LED3 + LED0"
command='\x01' + \
	'\x00\xfe\x00\xfe\x00' + \
	'\x00\x00\x00\x00\x12' + \
	'\xff\x00\x00\x00\x80' + \
	'\xff\x00\x00\x00\x80' + \
	'\xff\x00\x00\x00\x00' + \
	'\xff\x00\x00\x00\x00' + \
	'\x00\x00\x00\x00\x00'

dh.bulkWrite(0x02, command, len(command))
time.sleep(3)

print "LED2 + LED1"
command='\x01' + \
	'\x00\xfe\x00\xfe\x00' + \
	'\x00\x00\x00\x00\x0C' + \
	'\xff\x27\x10\x80\x32' + \
	'\xff\x27\x10\x80\x32' + \
	'\xff\x27\x10\x00\x32' + \
	'\xff\x27\x10\x00\x32' + \
	'\x00\x00\x00\x00\x00'

dh.bulkWrite(0x02, command, len(command))
time.sleep(3)

print "no LEDs"
command='\x01' + \
	'\x00\x00\x00\x00\x00' + \
	'\x00\x00\x00\x00\x20' + \
	'\xff\x07\x10\xff\x00' + \
	'\xff\x07\x10\xff\x00' + \
	'\xff\x07\x10\xff\x00' + \
	'\xff\x07\x10\xff\x00' + \
	'\x00\x00\x00\x00\x00'
	
dh.bulkWrite(0x02, command, len(command))

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux