diff mbox series

sixaxis: Fall back to matching VID/PID for unknown devices

Message ID 20210830213655.16e6c37a@rechenknecht2k11 (mailing list archive)
State New, archived
Headers show
Series sixaxis: Fall back to matching VID/PID for unknown devices | expand

Commit Message

Benjamin Valentin Aug. 30, 2021, 7:36 p.m. UTC
Commit 61745d2bb made device matching stricter.
Before, a third party device would be matched according to it's
vendor / device ID only.

Now we require it's name to be in the list of known devices too,
so the name is retained later on.

This regresses unknown third-party devices that are not in the list
(as reported by [0]).

We can try to keep up by expanding the list, but let's also gracefully
fall back to vid/pid matching if there is a device that we don't know.

[0] https://www.reddit.com/r/archlinux/comments/pdvdfd/a_dirty_fix_for_ps3_controller_bluetooth/

Signed-off-by: Benjamin Valentin <benpicco@googlemail.com>
---
 profiles/input/sixaxis.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

bluez.test.bot@gmail.com Aug. 30, 2021, 7:53 p.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=539421

---Test result---

Test Summary:
CheckPatch                    FAIL      0.27 seconds
GitLint                       FAIL      0.10 seconds
Prep - Setup ELL              PASS      38.50 seconds
Build - Prep                  PASS      0.10 seconds
Build - Configure             PASS      6.47 seconds
Build - Make                  PASS      165.30 seconds
Make Check                    PASS      8.34 seconds
Make Distcheck                PASS      191.86 seconds
Build w/ext ELL - Configure   PASS      7.05 seconds
Build w/ext ELL - Make        PASS      157.58 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
sixaxis: Fall back to matching VID/PID for unknown devices
WARNING:UNKNOWN_COMMIT_ID: Unknown commit id '61745d2bb', maybe rebased or not pulled?
#6: 
Commit 61745d2bb made device matching stricter.

WARNING:COMMIT_LOG_LONG_LINE: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#19: 
[0] https://www.reddit.com/r/archlinux/comments/pdvdfd/a_dirty_fix_for_ps3_controller_bluetooth/

- total: 0 errors, 2 warnings, 25 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

"[PATCH] sixaxis: Fall back to matching VID/PID for unknown devices" has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.


##############################
Test: GitLint - FAIL
Desc: Run gitlint with rule in .gitlint
Output:
sixaxis: Fall back to matching VID/PID for unknown devices
16: B1 Line exceeds max length (96>80): "[0] https://www.reddit.com/r/archlinux/comments/pdvdfd/a_dirty_fix_for_ps3_controller_bluetooth/"


##############################
Test: Prep - Setup ELL - PASS
Desc: Clone, build, and install ELL

##############################
Test: Build - Prep - PASS
Desc: Prepare environment for build

##############################
Test: Build - Configure - PASS
Desc: Configure the BlueZ source tree

##############################
Test: Build - Make - PASS
Desc: Build the BlueZ source tree

##############################
Test: Make Check - PASS
Desc: Run 'make check'

##############################
Test: Make Distcheck - PASS
Desc: Run distcheck to check the distribution

##############################
Test: Build w/ext ELL - Configure - PASS
Desc: Configure BlueZ source with '--enable-external-ell' configuration

##############################
Test: Build w/ext ELL - Make - PASS
Desc: Build BlueZ source with '--enable-external-ell' configuration



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/profiles/input/sixaxis.h b/profiles/input/sixaxis.h
index ab8831995..db518997a 100644
--- a/profiles/input/sixaxis.h
+++ b/profiles/input/sixaxis.h
@@ -74,6 +74,7 @@  get_pairing(uint16_t vid, uint16_t pid, const char *name)
 		},
 	};
 	guint i;
+	const struct cable_pairing *best_match = NULL;
 
 	for (i = 0; i < G_N_ELEMENTS(devices); i++) {
 		if (devices[i].vid != vid)
@@ -81,13 +82,16 @@  get_pairing(uint16_t vid, uint16_t pid, const char *name)
 		if (devices[i].pid != pid)
 			continue;
 
-		if (name && strcmp(name, devices[i].name))
+		/* if the device is unknown, use the next best match */
+		if (name && strcmp(name, devices[i].name)) {
+			best_match = &devices[i];
 			continue;
+		}
 
 		return &devices[i];
 	}
 
-	return NULL;
+	return best_match;
 }
 
 #endif /* _SIXAXIS_H_ */