Re: [PATCH v3 1/3] HID: switchcon: add nintendo switch controller driver

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

 



On Sun, 2019-01-27 at 22:04 -0600, Daniel J. Ogorchock wrote:
> The switchcon driver supports the Nintendo Switch Pro Controllers and
> the Joy-Cons. The Pro Controllers can be used over USB or Bluetooth.
> 
> The Joy-Cons each create their own, independent input devices, so it
> is
> up to userspace to combine them if desired.
> 
<snip>
> +static void switchcon_parse_report(struct switchcon_ctlr *ctlr, u8
> *data)
> +{
> +	struct input_dev *dev = ctlr->input;
> +	enum switchcon_ctlr_type type = ctlr->type;
> +	u32 btns;
> +
> +	btns = hid_field_extract(ctlr->hdev, data + 3, 0, 24);
> +
> +	if (type == SWITCHCON_CTLR_TYPE_PROCON ||
> +	    type == SWITCHCON_CTLR_TYPE_JOYCON_L) {

<snip>
> +	}
> +	if (type == SWITCHCON_CTLR_TYPE_PROCON ||
> +	    type == SWITCHCON_CTLR_TYPE_JOYCON_R) {

Did I read this code correctly, in that the 2 joy-cons will each report
their status as if they were independent?

I know that the Switch has a settings panel and probably some platform-
level code to deal with multiple sets of joycons being available, such
a pair attached to the body of the device and another pair used
individually by 2 players.

The "these 2 discrete devices are actually one" case could be handled
by a library that Peter is working on.

However, have you tested the joy-cons with a "charging grip"? Does the
power_supply reporting work for the joy-cons when charging via this
method? Do the joy-cons change behaviour, or work differently when
plugged in to the charging grip? Or do the joy-cons not have a "wired"
mode at all, and all the data is always sent via Bluetooth.

> +		if (match) {
> +			if (size > SC_MAX_RESP_SIZE)
> +				copy_size = SC_MAX_RESP_SIZE;
> +			else
> +				copy_size = size;

Use MIN()?

Cheers




[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