From: Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
To: "Jiri Kosina" <jikos@kernel.org>,
"Benjamin Tissoires" <benjamin.tissoires@redhat.com>,
"Pierre-Loup A. Griffais" <pgriffais@valvesoftware.com>,
"Cameron Gutman" <aicommander@gmail.com>,
"Clément VUCHENER" <clement.vuchener@gmail.com>,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org
Cc: Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
Subject: [PATCH v5 3/4] HID: steam: command to check wireless connection
Date: Sun, 11 Mar 2018 20:58:41 +0100 [thread overview]
Message-ID: <20180311195842.5551-4-rodrigorivascosta@gmail.com> (raw)
In-Reply-To: <20180311195842.5551-1-rodrigorivascosta@gmail.com>
The wireless adaptor does not tell if a device is already connected when
steam_probe() is run.
Use a command to request the connection status.
Signed-off-by: Rodrigo Rivas Costa <rodrigorivascosta@gmail.com>
---
drivers/hid/hid-steam.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
index 03eebc4c28ba..3d34716ae55f 100644
--- a/drivers/hid/hid-steam.c
+++ b/drivers/hid/hid-steam.c
@@ -118,6 +118,11 @@ static int steam_send_report(struct steam_device *steam,
return ret;
}
+static inline int steam_send_report_byte(struct steam_device *steam, u8 cmd)
+{
+ return steam_send_report(steam, &cmd, 1);
+}
+
static int steam_get_serial(struct steam_device *steam)
{
/*
@@ -139,6 +144,16 @@ static int steam_get_serial(struct steam_device *steam)
return 0;
}
+/*
+ * This command requests the wireless adaptor to post an event
+ * with the connection status. Useful if this driver is loaded when
+ * the controller is already connected.
+ */
+static inline int steam_request_conn_status(struct steam_device *steam)
+{
+ return steam_send_report_byte(steam, 0xb4);
+}
+
static int steam_input_open(struct input_dev *dev)
{
struct steam_device *steam = input_get_drvdata(dev);
@@ -360,6 +375,7 @@ static int steam_probe(struct hid_device *hdev,
goto hid_hw_open_fail;
}
hid_info(hdev, "Steam wireless receiver connected");
+ steam_request_conn_status(steam);
} else {
ret = steam_register(steam);
if (ret) {
--
2.16.2
next prev parent reply other threads:[~2018-03-11 19:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-11 19:58 [PATCH v5 0/4] new driver for Valve Steam Controller Rodrigo Rivas Costa
2018-03-11 19:58 ` [PATCH v5 1/4] HID: add " Rodrigo Rivas Costa
2018-03-11 19:58 ` [PATCH v5 2/4] HID: steam: add serial number information Rodrigo Rivas Costa
2018-03-11 19:58 ` Rodrigo Rivas Costa [this message]
2018-03-11 19:58 ` [PATCH v5 4/4] HID: steam: add battery device Rodrigo Rivas Costa
2018-03-11 23:12 ` [PATCH v5 0/4] new driver for Valve Steam Controller Pierre-Loup A. Griffais
2018-03-12 7:35 ` Rodrigo Rivas Costa
2018-03-12 14:30 ` Clément VUCHENER
2018-03-12 20:51 ` Rodrigo Rivas Costa
2018-03-14 16:39 ` Benjamin Tissoires
2018-03-15 21:06 ` Rodrigo Rivas Costa
2018-03-17 21:54 ` Pierre-Loup A. Griffais
2018-03-19 20:08 ` Rodrigo Rivas Costa
2018-03-19 21:06 ` Clément VUCHENER
2018-03-20 19:18 ` Rodrigo Rivas Costa
2018-03-21 15:47 ` Benjamin Tissoires
2018-03-21 17:56 ` Rodrigo Rivas Costa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180311195842.5551-4-rodrigorivascosta@gmail.com \
--to=rodrigorivascosta@gmail.com \
--cc=aicommander@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=clement.vuchener@gmail.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pgriffais@valvesoftware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).