diff mbox

[2/5] hid: sony: Add support for the Sony Motion Controller

Message ID 20150505214736.GA16332@amd (mailing list archive)
State New, archived
Delegated to: Jiri Kosina
Headers show

Commit Message

Pavel Machek May 5, 2015, 9:47 p.m. UTC
Hi!

> Not sure how this is expected to work. I tried: (and did not get any
> vibrations).

Hmm. Seems I tried wrong device. But no vibrations with the right
device, either:

root@duo:/sys/class/leds/0003:054C:03D5.0002:global# echo 4 | fftest
/dev/input/event8
Force feedback test program.
HOLD FIRMLY YOUR WHEEL OR JOYSTICK TO PREVENT DAMAGES

Device /dev/input/event8 opened
Features:
  * Absolute axes: X, Y, Z, RZ, Misc ,
      [27 00 00 00 00 FF FF 7F ]
        * Relative axes:
	    [00 00 ]
	      * Force feedback effects types: Periodic, Rumble, Gain,
	          Force feedback periodic effects: Square, Triangle,
		  Sine,
		      [00 00 00 00 00 00 00 00 00 00 03 07 01 00 00 00
		      ]
		        * Number of simultaneous effects: 16

Setting master gain to 75% ... OK
Uploading effect #0 (Periodic sinusoidal) ... OK (id 0)
Uploading effect #1 (Constant) ... Error: Invalid argument
Uploading effect #2 (Spring) ... Error: Invalid argument
Uploading effect #3 (Damper) ... Error: Invalid argument
Uploading effect #4 (Strong rumble, with heavy motor) ... OK (id 1)
Uploading effect #5 (Weak rumble, with light motor) ... OK (id 2)
Enter effect number, -1 to exit
Now Playing: Strong Rumble
Enter effect number, -1 to exit
Read error
Stopping effects
root@duo:/sys/class/leds/0003:054C:03D5.0002:global#

If it has just one motor, should it say so in the description? Not
advertising both heavy and light motor.

If I do this, I can control vibrations using the "red" led. Value of
70 is lowest that produces anything...

Best regards,
								Pavel

Comments

Pavel Machek May 5, 2015, 9:55 p.m. UTC | #1
Hi!

> root@duo:/sys/class/leds/0003:054C:03D5.0002:global# echo 4 | fftest
> /dev/input/event8
> Force feedback test program.
> HOLD FIRMLY YOUR WHEEL OR JOYSTICK TO PREVENT DAMAGES
> 
> Device /dev/input/event8 opened
> Features:
>   * Absolute axes: X, Y, Z, RZ, Misc ,
>       [27 00 00 00 00 FF FF 7F ]
>         * Relative axes:
> 	    [00 00 ]
> 	      * Force feedback effects types: Periodic, Rumble, Gain,
> 	          Force feedback periodic effects: Square, Triangle,
> 		  Sine,
> 		      [00 00 00 00 00 00 00 00 00 00 03 07 01 00 00 00
> 		      ]
> 		        * Number of simultaneous effects: 16
> 
> Setting master gain to 75% ... OK
> Uploading effect #0 (Periodic sinusoidal) ... OK (id 0)
> Uploading effect #1 (Constant) ... Error: Invalid argument
> Uploading effect #2 (Spring) ... Error: Invalid argument
> Uploading effect #3 (Damper) ... Error: Invalid argument
> Uploading effect #4 (Strong rumble, with heavy motor) ... OK (id 1)
> Uploading effect #5 (Weak rumble, with light motor) ... OK (id 2)
> Enter effect number, -1 to exit
> Now Playing: Strong Rumble
> Enter effect number, -1 to exit
> Read error
> Stopping effects
> root@duo:/sys/class/leds/0003:054C:03D5.0002:global#
> 
> If it has just one motor, should it say so in the description? Not
> advertising both heavy and light motor.

Umm. Using echo with fftest was not good idea. Using it from command
line, it works normally.

Thanks and sorry for confusion,
								Pavel
Frank Praznik May 5, 2015, 11:37 p.m. UTC | #2
On 5/5/2015 17:47, Pavel Machek wrote:
> If it has just one motor, should it say so in the description? Not
> advertising both heavy and light motor.
>

The FF_RUMBLE flag exposes two motors by default and there doesn't seem 
to be a way to change it.

This is how the Wiimote with a single motor works (FF_RUMBLE and 
treating the strong/weak motors as one).  Would one of the other effects 
be more suitable?
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pavel Machek May 6, 2015, 9:31 a.m. UTC | #3
On Tue 2015-05-05 19:37:34, Frank Praznik wrote:
> On 5/5/2015 17:47, Pavel Machek wrote:
> >If it has just one motor, should it say so in the description? Not
> >advertising both heavy and light motor.
> >
> 
> The FF_RUMBLE flag exposes two motors by default and there doesn't seem to
> be a way to change it.
> 
> This is how the Wiimote with a single motor works (FF_RUMBLE and treating
> the strong/weak motors as one).  Would one of the other effects be more
> suitable?

I don't know enough about the force feedback subsystem, sorry. I guess
it is okay as it is, then... Thanks for all the work!
									Pavel
diff mbox

Patch

diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 46e4ceb..de02a35 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1751,6 +1751,8 @@  static void motion_state_worker(struct work_struct *work)
 
 #ifdef CONFIG_SONY_FF
 	report->rumble = max(sc->right, sc->left);
+	report->rumble = report->r;
+	printk("Rumble: %d\n", report->r);
 #endif
 
 	hid_hw_output_report(hdev, (__u8 *)report,
@@ -1770,7 +1772,7 @@  static int sony_allocate_output_report(struct sony_sc *sc)
 		sc->output_report_dmabuf = kmalloc(DS4_REPORT_0x05_SIZE,
 						GFP_KERNEL);
 	else if (sc->quirks & MOTION_CONTROLLER)
-		kmalloc(sizeof(struct motion_output_report_02),
+		sc->output_report_dmabuf = kmalloc(sizeof(struct motion_output_report_02),
 				GFP_KERNEL);
 	else
 		return 0;