linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 4/4] Remove use of read_device_id in wiimote plugin
Date: Thu, 22 Sep 2011 18:51:52 +0300	[thread overview]
Message-ID: <1316706712-17611-4-git-send-email-luiz.dentz@gmail.com> (raw)
In-Reply-To: <1316706712-17611-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

Make use of btd_device_get_vendor and btd_device_get_product intead.
---
 plugins/wiimote.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/plugins/wiimote.c b/plugins/wiimote.c
index e60231b..fead72a 100644
--- a/plugins/wiimote.c
+++ b/plugins/wiimote.c
@@ -60,20 +60,21 @@ static ssize_t wii_pincb(struct btd_adapter *adapter, struct btd_device *device,
 {
 	uint16_t vendor, product;
 	bdaddr_t sba, dba;
-	char src_addr[18], dst_addr[18];
+	char addr[18];
 
 	adapter_get_address(adapter, &sba);
 	device_get_address(device, &dba);
-	ba2str(&sba, src_addr);
-	ba2str(&dba, dst_addr);
-
-	if (0 == read_device_id(src_addr, dst_addr, NULL, &vendor, &product,
-									NULL)) {
-		if (vendor == 0x057e && product == 0x0306) {
-			DBG("Forcing fixed pin on detected wiimote %s", dst_addr);
-			memcpy(pinbuf, &sba, 6);
-			return 6;
-		}
+	ba2str(&dba, addr);
+
+	vendor = btd_device_get_vendor(device);
+	if (vendor != 0x057e)
+		return 0;
+
+	product = btd_device_get_product(device);
+	if (product == 0x0306) {
+		DBG("Forcing fixed pin on detected wiimote %s", addr);
+		memcpy(pinbuf, &sba, 6);
+		return 6;
 	}
 
 	return 0;
-- 
1.7.6.2


  parent reply	other threads:[~2011-09-22 15:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-22 15:51 [PATCH BlueZ 1/4] Add Vendor, Product and Version properties to org.bluez.Device Luiz Augusto von Dentz
2011-09-22 15:51 ` [PATCH BlueZ 2/4] Print Vendor/Product/Version in hexadecimal Luiz Augusto von Dentz
2011-09-22 15:51 ` [PATCH BlueZ 3/4] Remove use of read_device_id in input plugin Luiz Augusto von Dentz
2011-09-22 15:51 ` Luiz Augusto von Dentz [this message]
2011-10-02 22:45 ` [PATCH BlueZ 1/4] Add Vendor, Product and Version properties to org.bluez.Device Johan Hedberg

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=1316706712-17611-4-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /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).