Re: Obexd 0.8 : pull failure

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

 



Hi Marcel,

Here is the way I proceed :
- start the bluetooth daemon (bluetoothd -nd &)
- start a session D-bus and update the environment by exporting the
DBUS variables
- start the obex-client daemon (/usr/libexec/obex-client &)

To pull a business card, I use a C application, i.e. translation of
the python "pull-business-card" script (I did not succeed yet to
cross-compile the dbus-python package for the iMX31 platform). I
attached the source code as information.
Herre is the full output of the application :

$ puller 00:0E:ED:01:DB:67 /var/obex.pull.vcf
Obex puller : session bus connected
Obex puller : message created
Obex puller : message sent
Obex puller : disconnected

At this time, the mobile (Nokia 6810) asks whether data from the
target may be accepted. As soon as the mobile has accepted, the
following error appears on the OBEX client side :

bluetoothd[1773]: adapter_get_device(00:0E:ED:01:DB:67)
gw_obex_xfer_read(): Not found

Looking in the source code (client/session.c and openobex 1.3), one
can note that an OBEX_RSP_NOT_FOUND (0x44) response has been received.

Here is the point I'm blocked. I don't know in which direction
investigate !? I don't know what additional info can be given !?

Thanks in advance for your help.

Regards.
Thierry



2009/2/1 Marcel Holtmann <marcel@xxxxxxxxxxxx>:
> Hi Thierry,
>
>> Any attempt to pull a business card using the OBEX protocol failed
>> with the following message :
>>
>> bluetoothd[1844]: adapter_get_device(00:0E:ED:01:DB:67)
>> gw_obex_xfer_read(): Not found
>>
>> What does it mean ? What could be wrong ?
>>
>> Tested with BlueZ 4.26.
>
> we would need more details and log outputs to analyze this.
>
> Regards
>
> Marcel
>
>
>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <dbus/dbus.h>

#ifndef TRUE
#define TRUE 0x01
#endif

/* Private calls ------------------------------------------------ */
static usage(FILE * stream, char * command)
{
	fprintf(stream, "Usage : %s <remote address> <file_name>\n", command);
}

static void display_error(DBusError *perr, const char * message)
{
		if (dbus_error_is_set(perr) == TRUE) {
			fprintf(stderr, "%s : %s\n",message, perr->message);
			dbus_error_free(perr);
		} else
			fprintf(stderr, "%s\n", message);
}

/* The main ---------------------------------------------------- */
int main(int argc, char *argv[])
{
	DBusConnection *conn;
	DBusError err;
	DBusMessage * msg, * reply;
	DBusMessageIter iter, dict, entry, value;
	char * address, * file;
    int ret = 0;
    unsigned int serial;

	if (argc != 3) {
		fprintf(stderr, "Invalid parameters count !\n");
		usage(stderr, argv[0]);
		exit(EXIT_FAILURE);
	}

	address = argv[1];
	file = argv[2];

	dbus_error_init(&err);

    /* Connect the session bus */
	conn = dbus_bus_get(DBUS_BUS_SESSION, &err);
	if (conn == NULL) {
        display_error(&err, "Cannot connect session bus");
		exit(EXIT_FAILURE);
	}
    else
        printf("Obex puller : session bus connected\n");

	/* Create the message to be sent */
	msg = dbus_message_new_method_call("org.openobex.client", "/",
                                       "org.openobex.Client", "PullBusinessCard");
	if ( !msg ) {
		fprintf(stderr, "Cannot allocate call method PullBusinessCard\n");
        dbus_connection_unref(conn);
		exit(EXIT_FAILURE);
	}

	dbus_message_iter_init_append(msg, &iter);

	/* Add the destination argument */
	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
			DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
			DBUS_TYPE_STRING_AS_STRING DBUS_TYPE_VARIANT_AS_STRING
			DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &dict);
	dbus_message_iter_open_container(&dict, DBUS_TYPE_DICT_ENTRY,
									 NULL, &entry);
	char * key = "Destination";
	dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key);
	char sig[2] = { DBUS_TYPE_STRING, '\0' };
	dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, sig, &value);
	dbus_message_iter_append_basic(&value, DBUS_TYPE_STRING, &address);
	dbus_message_iter_close_container(&entry, &value);
	dbus_message_iter_close_container(&dict, &entry);
	dbus_message_iter_close_container(&iter, &dict);

	/* Add the file argument */
	dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING, &file);

    printf("Obex puller : message created\n");

	/* Send the message */
	if ( !dbus_connection_send(conn, msg, &serial) ) {
		fprintf(stderr, "Cannot send the message (serial=%u)\n", serial);
        dbus_message_unref(msg);
        dbus_connection_unref(conn);
		ret = EXIT_FAILURE;
	}
#if 0
    if ((reply = dbus_connection_send_with_reply_and_block(conn, msg, 60000, &err)) == NULL) {
        display_error(&err, "Cannot send the message !");
        ret = EXIT_FAILURE;
    }
#endif
    else
        printf("Obex puller : message sent\n");

	dbus_message_unref(msg);
	dbus_connection_flush(conn);

	/* Disconnect */
	dbus_connection_unref(conn);
    printf("Obex puller : disconnected\n");

	return ret;
}

[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux