aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-sony.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-09-25HID: sony: Update the DualShock 4 touchpad resolutionFrank Praznik1-2/+2
The DualShock 4 touchpad has been measured to have a resolution of 44.86 dots/mm which equates to 1920x942. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-09-22HID: sony: Set touchpad bits in the input_configured callbackFrank Praznik1-34/+40
Set the DualShock4 touchpad bits in the input_configured callback so that they are registered properly for any input devices created during hid_hw_start. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-09-15HID: sony: Update file header and correct commentsFrank Praznik1-5/+6
Update the file header and correct an outdated comment block. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-09-15HID: sony: Corrections for the DualShock 4 HID descriptorFrank Praznik1-6/+6
Fix a few minor issues in the HID descriptor: - A 6 bit entry had a logical maximum of 255 when the largest it can be is 63. - A logical max value was incorrectly being set to -1 instead of 255. - Set the min/max of the gyroscopes to -8192/8191 as that is the range of values which represent the true controller orientation. Any values beyond those extents are just noise. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-09-01HID: sony: Set the Sixaxis cable state correctlyFrank Praznik1-1/+2
Bit 3 in byte 31 of the Sixaxis report indicates whether the battery is charging or not charging as opposed to whether or not the cable is plugged in. As a result, when connected via USB and fully charged, the power_supply status is wrongly reported as 'Discharging' instead of 'Full'. Use the battery level value to set the cable state so that the power status is reported correctly as that seems to be the only reliable way to determine the cable status on the Sixaxis. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-07-30HID: sony: Default initialize all elements of the LED max_brightness array to 1Frank Praznik1-1/+1
Previously only the first element of the array was initialized to 1 leading to potential incorrect max brightness values for the LEDs on the Dualshock 3 and buzzer controllers. Use a designated initializer to initialize the whole array to the correct value. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-06-25HID: sony: Remove an old and redundant commentAntonio Ospite1-2/+0
Remove an old redundant comment before sony_report_fixup(), it must have been a leftover from the first version of the driver: sony_report_fixup() now handles all the supported devices, not only the Sony Vaio VGX. The comment is also redundant as the same information provided by it is also present in the body of the function. Signed-off-by: Antonio Ospite <ao2@ao2.it> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-06-25HID: sony: Format and comment sixaxis_rdescAntonio Ospite1-19/+74
Reformat sixaxis_rdesc to reflect its HID structure, and comment each field. This will make it easier to validate changes to the descriptor in the future. No functional changes are introduced, the descriptor is exactly the same as before byte by byte. The heavy lifting has been done with the help of hidrd-convert: https://github.com/DIGImend/hidrd Signed-off-by: Antonio Ospite <ao2@ao2.it> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-06-25HID: sony: Always override the Sixaxis descriptorAntonio Ospite1-21/+10
Simplify the logic of overriding the Sixaxis HID descriptor, this will make it easier to amend the descriptor in future commits. The current code does this: if (original sixaxis via USB or BT) fixup only a part of the descriptor else if (sixaxis compatible controller) override the _whole_ descriptor but the end result is exactly the same, except for the trailing zero in the case of original BT controllers. So let's just regularize the process, and always override the HID descriptor. Always overriding the descriptor changes the current semantic a little bit, before this change the BT descriptor still had the trailing zero byte, while now it is exactly the same as the descriptor of the controller via USB, but that does not affect proper operation of the device. Note that overriding the whole descriptor for original devices is not strictly necessary for now, but it simplifies the code and in the future the report descriptor will be patched further and keys will be remapped, so it's handy to have only one place to patch. Signed-off-by: Antonio Ospite <ao2@ao2.it> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-06-25HID: sony: Use the SIXAXIS_CONTROLLER constant when possibleAntonio Ospite1-3/+1
Instead of checking for SIXAXIS_CONTROLLER_USB and SIXAXIS_CONTROLLER_BT separately, a check on SIXAXIS_CONTROLLER can be used when setting connect_mask. Signed-off-by: Antonio Ospite <ao2@ao2.it> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-04-24HID: hid-sony - allow 3rd party INTEC controller to turn off all ledsSimon Wood1-0/+4
Without this patch the 3rd party INTEC (PS3) controller will blink all leds when user turns them off, it appears to require an extra flag set. Signed-off-by: Simon Wood <simon@mungewell.org> Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-04-24HID: sony: Add blink support to the Sixaxis and DualShock 4 LEDsFrank Praznik1-25/+124
Add support for setting the blink rate of the LEDs. The Sixaxis allows control over each individual LED, but the Dualshock 4 only has one global control for controlling the hardware blink rate so individual colors will fall back to software timers. Setting the brightness cancels the blinking as per the LED class specifications. The Sixaxis and Dualshock 4 controllers accept delays in decisecond increments from 0 to 255 (2550 milliseconds). The value at index 1 of the DualShock 4 USB output report must be 0xFF or the light bar won't blink. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-04-24HID: sony: Initialize the controller LEDs with a device ID valueFrank Praznik1-5/+114
Add an IDA id allocator to assign unique, sequential device ids to Sixaxis and DualShock 4 controllers. Use the device ID to initialize the Sixaxis and DualShock 4 controller LEDs to default values. The number or color of the controller is set relative to other connected Sony controllers. Set the LED class brightness values to the initial values and add the new led to the array before calling led_classdev_register so that the correct brightness value shows up in the LED sysfs entry. Use explicit module init and exit functions since the IDA allocator must be manually destroyed when the module is unloaded. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-04-24HID: sony: Use the controller Bluetooth MAC address as the unique value in the battery name stringFrank Praznik1-6/+2
Use the controller Bluetooth MAC address as the unique identifier in the battery name string instead of the atomic integer that was used before. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-04-24HID: sony: Convert startup and shutdown functions to use a uniform parameter typeFrank Praznik1-35/+32
Convert all of the local initialization and shutdown functions to take a parameter type of struct sony_sc* instead of using a mix of struct sony_sc* and struct hid_device*. Allows for the removal of some calls to hid_get_drvdata(). Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-04-24HID: sony: Use a struct for the Sixaxis output report.Frank Praznik1-17/+49
Use a struct for the Sixaxis output report that uses named members to set the report fields. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-04-24HID: sony: Use inliners for work queue initialization and cancellationFrank Praznik1-10/+19
Use inliners to make sure that the work queue initialization flag is always checked and set correctly when initializing or cancelling the work queue. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-04-03HID: sony: Fix cancel_work_sync mismergeFrank Praznik1-2/+0
Remove redundant cancel_work_sync() call caused by mismerge. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-04-01HID: sony: fix force feedback mismergeJiri Kosina1-4/+0
Fix unfortunate mismerge between the fixes and sony branch causing code duplication and unterminated basic block. Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-04-01Merge branches 'for-3.15/multitouch', 'for-3.15/sony' and 'for-3.15/uhid' into for-linusJiri Kosina1-1/+11
2014-04-01Merge branch 'for-3.15/hid-core-ll-transport-cleanup' into for-linusJiri Kosina1-96/+704
Conflicts: drivers/hid/hid-ids.h drivers/hid/hid-sony.c drivers/hid/i2c-hid/i2c-hid.c
2014-04-01Merge branch 'for-3.15/hid-core-ll-transport-cleanup' into for-3.15/sonyJiri Kosina1-48/+16
2014-04-01HID: sony: Set the quriks flag for Bluetooth controllersFrank Praznik1-0/+10
The Sixaxis and DualShock 4 want HID output reports sent on the control endpoint when connected via Bluetooth. Set the HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP flag for these devices so hidraw write() works properly. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-04-01HID: sony: Fix Sixaxis cable state detectionFrank Praznik1-1/+1
Byte 31 of the Sixaxis report can change depending on whether or not the controller is rumbling. Using bit 3 is the only reliable way to detect the state of the cable regardless of rumble activity. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-03-14HID: sony: do not rely on hid_output_raw_reportBenjamin Tissoires1-46/+14
hid_out_raw_report is going to be obsoleted as it is not part of the unified HID low level transport documentation (Documentation/hid/hid-transport.txt) To do so, we need to introduce two new quirks: * HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP: this quirks prevents the transport driver to use the interrupt channel to send output report (and thus force to use HID_REQ_SET_REPORT command) * HID_QUIRK_SKIP_OUTPUT_REPORT_ID: this one forces usbhid to not include the report ID in the buffer it sends to the device through HID_REQ_SET_REPORT in case of an output report This also fixes a regression introduced in commit 3a75b24949a8 (HID: hidraw: replace hid_output_raw_report() calls by appropriates ones). The hidraw API was not able to communicate with the PS3 SixAxis controllers in USB mode. Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Tested-by: Antonio Ospite <ao2@ao2.it> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-03-14Merge branch 'for-3.15/sony' into for-3.15/hid-core-ll-transport-cleanupJiri Kosina1-62/+692
2014-02-24HID: sony: Prevent duplicate controller connections.Frank Praznik1-0/+140
If a Sixaxis or Dualshock 4 controller is connected via USB while already connected via Bluetooth it will cause duplicate devices to be added to the input device list. To prevent this a global list of controllers and their MAC addresses is maintained and new controllers are checked against this list. If a duplicate is found, the probe function will exit with -EEXIST. On USB the MAC is retrieved via a feature report. On Bluetooth neither controller reports the MAC address in a feature report so the MAC is parsed from the uniq string. As uniq cannot be guaranteed to be a MAC address in every case (uHID or the behavior of HIDP changing) a parsing failure will not prevent the connection. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-24HID: sony: Perform a boundry check on the sixaxis battery level index.Frank Praznik1-1/+2
Make sure that an out-of-bounds read doesn't occur in the Sixaxis battery level lookup table in the event that the controller sends an invalid battery status value in the report. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-24HID: sony: Fix work queue issuesFrank Praznik1-14/+14
Only initialize force feedback for devices that actually support it (Sixaxis and Dualshock 4) to prevent calls to schedule_work() with an uninitialized work queue. Move the cancel_work_sync() call out of sony_destroy_ff() since the state worker is used for the LEDs even when force-feedback is disabled. Remove the sony_destroy_ff() function since it is no longer used. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-24HID: sony: Fix multi-line comment stylingFrank Praznik1-15/+30
Convert multi-line comments to comply with the kernel coding style. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-20HID: sony: Fix work queue issues.Frank Praznik1-15/+12
Don't initialize force-feedback for devices that don't support it to avoid calls to schedule_work() with an uninitialized work_struct. Move the cancel_work_sync() call out of sony_destroy_ff() since the state worker is used for the LEDs even when force-feedback is disabled. Remove sony_destroy_ff() to avoid a compiler warning since it is no longer used. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-20HID: sony: Enable LED controls and rumble for the Sixaxis on Bluetooth.Frank Praznik1-11/+13
Add a SIXAXIS_CONTROLLER macro to simplify conditionals where the connection type is irrelevant. Enable the LED and force feedback controls for Sixaxis controllers connected via Bluetooth. Send Sixaxis Bluetooth output reports on the control channel. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-17HID: sony: Correct Sixaxis battery reportingFrank Praznik1-2/+2
The battery_charging and cable_state flags were backwards on the Sixaxis. The low bit of report byte 30 is 0 when charging and 1 when not. Bit 5 of byte 31 is 0 when a USB cable is connected and 1 when not. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-17HID: replace hid_output_raw_report with hid_hw_raw_request for feature requestsBenjamin Tissoires1-2/+2
ret = hid_output_raw_report(A, B, C, HID_FEATURE_REPORT); is equivalent to ret = hid_hw_raw_request(A, B[0], B, C, HID_FEATURE_REPORT, HID_REQ_SET_REPORT); whatever the transport layer is. So use the new API where available Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-17HID: sony: Add conditionals to enable all features in Bluetooth modeFrank Praznik1-7/+30
Add the conditionals to enable rumble, battery reporting, LED and touchpad support for the Dualshock 4 in Bluetooth mode. Add dualshock4_set_operational_bt to initialize the controller to the proper operational state. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-17HID: sony: Set initial battery level to 100% to avoid false low battery warningsFrank Praznik1-0/+5
Set the initial battery level to 100% to avoid false low battery warnings if the battery state is polled before a report with the actual battery level is received. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-17HID: sony: Add Dualshock 4 Bluetooth battery and touchpad parsingFrank Praznik1-8/+20
Add Dualshock 4 battery and touchpad parsing for Bluetooth reports. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-17HID: sony: Add Dualshock 4 Bluetooth output report formattingFrank Praznik1-5/+16
Add formating for the Dualshock 4 output report data in Bluetooth mode. In Bluetooth mode the Dualshock 4 wants output reports sent on the control channel. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-17HID: sony: Add modified Dualshock 4 Bluetooth HID descriptorFrank Praznik1-0/+214
By default, the Dualshock 4 sends controller data via report 1. Once a valid output report 0x11 is received or a feature report of type 0x02 is requested the controller changes from sending data in report 1 to sending data in report 17, which is unmapped in the default descriptor. The mappings have to be moved to report 17 to let the HID driver properly process the incoming reports. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-17HID: sony: Use low-level transport driver functionsFrank Praznik1-42/+14
Switch to the low-level transport driver functions. sony_set_output_report is removed since it is no longer used. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-17Merge branch 'for-3.15/hid-core-ll-transport-cleanup' into for-3.15/sonyJiri Kosina1-4/+5
2014-02-17HID: introduce helper to access hid_output_raw_report()Benjamin Tissoires1-3/+3
Add a helper to access hdev->hid_output_raw_report(). To convert the drivers, use the following snippets: for i in drivers/hid/*.c do sed -i.bak "s/[^ \t]*->hid_output_raw_report(/hid_output_raw_report(/g" $i done Then manually fix for checkpatch.pl Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-17HID: remove hid_get_raw_report in struct hid_deviceBenjamin Tissoires1-1/+2
dev->hid_get_raw_report(X) and hid_hw_raw_request(X, HID_REQ_GET_REPORT) are strictly equivalent. Switch the hid subsystem to the hid_hw notation and remove the field .hid_get_raw_report in struct hid_device. Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-02-06HID: hid-sony: report actual brightness value when reading LEDSimon Wood1-6/+3
The Dualshock4 controller contains a RGB LED, which is enabled via the '/sys/class/leds' interface. At present the driver only returns whether each of the RGB LEDs is lit (ie not off), but no indication of it's brightness. This patch fixes the reading of the current brightnes so that it returns the value (rather than just off=0, on=LED_FULL). Tested on the DS4 and SixAxis (for compatibility). Signed-off-by: Simon Wood <simon@mungewell.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-01-28HID: sony: add output events for the multi-touch pad on the Dualshock 4Frank Praznik1-0/+54
Add output events for the multi-touch pad on the Dualshock 4. The touchpad has a resolution of 1920x940 and is capable of 2 simultaneous touches. A 'Type B' stateful slot protocol is implemented as defined in Documentation/input/multi-touch-protocol.txt Applications can use the touchpad data by processing the ABS_MT_SLOT, ABS_MT_TRACKING_ID, ABS_MT_POSITION_X and ABS_MT_POSITION_Y events. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-01-28HID: sony: add battery status reporting for the Sixaxis and Dualshock 4Frank Praznik1-1/+185
Add battery status reporting for the Sixaxis and Dualshock 4 controllers. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-01-21HID: sony: Use colors for the Dualshock 4 LED namesFrank Praznik1-7/+20
Use the naming scheme 'devicename:colour' for the Dualshock 4 LED lightbar controls as specified in Documentation/leds/leds-class.txt Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-01-21HID: sony: Add annotated HID descriptor for the Dualshock 4Frank Praznik1-64/+256
Add annotated HID descriptor for the Dualshock 4. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-01-20HID: sony: Cache the output report for the Dualshock 4Frank Praznik1-20/+35
Retrieve and cache the output report for the Dualshock 4 in sony_probe() instead of repeatedly walking the report list in the worker function. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Reviewed-by: David Herrmann <dh.herrmann@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2014-01-17HID: sony: Map gyroscopes and accelerometers to axesFrank Praznik1-0/+78
Use a modified HID descriptor for the Dualshock 4 to assign the gyroscope sensors and accelerometers to axes. Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>