···360360}
361361362362void
363363-u_device_assign_xdev_roles(struct xrt_device **xdevs, size_t xdev_count, int *head, int *left, int *right)
363363+u_device_assign_xdev_roles(struct xrt_device **xdevs, size_t xdev_count, int *head, int *left, int *right, int *gamepad)
364364{
365365 *head = XRT_DEVICE_ROLE_UNASSIGNED;
366366 *left = XRT_DEVICE_ROLE_UNASSIGNED;
367367 *right = XRT_DEVICE_ROLE_UNASSIGNED;
368368+ *gamepad = XRT_DEVICE_ROLE_UNASSIGNED;
368369 assert(xdev_count < INT_MAX);
369370370371 for (size_t i = 0; i < xdev_count; i++) {
···388389 try_move_assignment(xdevs, right, left);
389390 if (*right == XRT_DEVICE_ROLE_UNASSIGNED) {
390391 *right = (int)i;
392392+ }
393393+ break;
394394+ case XRT_DEVICE_TYPE_GAMEPAD:
395395+ if (*gamepad == XRT_DEVICE_ROLE_UNASSIGNED) {
396396+ *gamepad = (int)i;
391397 }
392398 break;
393399 case XRT_DEVICE_TYPE_ANY_HAND_CONTROLLER:
+3-2
src/xrt/auxiliary/util/u_device.h
···131131#define XRT_DEVICE_ROLE_UNASSIGNED (-1)
132132133133/*!
134134- * Helper function to assign head, left hand and right hand roles.
134134+ * Helper function to assign head, left hand, right hand, and gamepad roles.
135135 *
136136 * @ingroup aux_util
137137 */
138138void
139139-u_device_assign_xdev_roles(struct xrt_device **xdevs, size_t xdev_count, int *head, int *left, int *right);
139139+u_device_assign_xdev_roles(
140140+ struct xrt_device **xdevs, size_t xdev_count, int *head, int *left, int *right, int *gamepad);
140141141142/*!
142143 * Helper function for `get_view_pose` in an HMD driver.