linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frederic Danis <frederic.danis@palmsource.com>
To: BlueZ development <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] [PATCH] Minor classes support
Date: Tue, 08 Aug 2006 17:21:50 +0200	[thread overview]
Message-ID: <44D8AC0E.1080308@palmsource.com> (raw)
In-Reply-To: <1151325308.7694.16.camel@localhost>

[-- Attachment #1: Type: text/plain, Size: 724 bytes --]

Hello,

We found a bug in DBus function GetRemoteMinorClass when major class is 
"imaging". In this case, the minor class can be a combo of minor values 
(minor part of the class is not an "index" in a table but a "field of 
bit", e.g. "scanner printer").
The patch attached returns the first matching value. It may be useful to 
change this API to allow it to return multiple values.

Regards

Fred

-----------------------------------------------
It is not by improving the oil lamp that one invents the electric bulb!
-----------------------------------------------
Danis Frederic            PalmSource Europe
Software engineer
Mail : mailto:frederic.danis@palmsource.com
-----------------------------------------------


[-- Attachment #2: minor_imaging_fix.patch --]
[-- Type: text/plain, Size: 1363 bytes --]

--- dbus-adapter.c.orig	2006-08-08 15:35:30.000000000 +0200
+++ dbus-adapter.c	2006-08-08 15:37:42.000000000 +0200
@@ -1222,19 +1222,19 @@
 								void *data)
 {
 	DBusMessage *reply;
-	const char *major_class;
+	const char *minor_class;
 	uint32_t class;
 
 	if (get_remote_class(conn, msg, data, &class) < 0)
 		return DBUS_HANDLER_RESULT_HANDLED;
 
-	major_class = minor_class_str(class);
+	minor_class = minor_class_str(class);
 
 	reply = dbus_message_new_method_return(msg);
 	if (!reply)
 		return DBUS_HANDLER_RESULT_NEED_MEMORY;
 
-	dbus_message_append_args(reply, DBUS_TYPE_STRING, &major_class,
+	dbus_message_append_args(reply, DBUS_TYPE_STRING, &minor_class,
 					DBUS_TYPE_INVALID);
 
 	return send_reply_and_unref(conn, reply);
@@ -2275,8 +2275,17 @@
 		minor_index = (class >> 6) & 0x03;
 		return peripheral_minor_cls[minor_index];
 	case 6: /* imaging */
-		minor_index = (class >> 4) & 0x0F;
-		return imaging_minor_cls[minor_index];
+		{
+			uint8_t shift_minor = 0;
+
+			minor_index = (class >> 4) & 0x0F;
+			while (shift_minor < (sizeof(imaging_minor_cls) / sizeof(*imaging_minor_cls))) {
+				if (((minor_index >> shift_minor) & 0x01) == 0x01)
+					return imaging_minor_cls[shift_minor];
+				shift_minor++;
+			}
+		}
+		break;
 	case 7: /* wearable */
 		minor_index = (class >> 2) & 0x3F;
 		return wearable_minor_cls[minor_index];

[-- Attachment #3: Type: text/plain, Size: 373 bytes --]

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]

_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

  reply	other threads:[~2006-08-08 15:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-06 14:25 [Bluez-devel] [PATCH] Minor classes support Frederic Danis
2006-06-14  5:44 ` Marcel Holtmann
2006-06-19 12:59   ` Frederic Danis
2006-06-26 12:35     ` Marcel Holtmann
2006-08-08 15:21       ` Frederic Danis [this message]
2006-08-09 22:20         ` Marcel Holtmann
2006-08-10 14:42           ` Frederic Danis
2006-08-10 19:02             ` Marcel Holtmann

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=44D8AC0E.1080308@palmsource.com \
    --to=frederic.danis@palmsource.com \
    --cc=bluez-devel@lists.sourceforge.net \
    /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).