diff options
| author | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-01-19 21:12:49 +0000 | 
|---|---|---|
| committer | Claudio Takahasi <claudio.takahasi@openbossa.org> | 2007-01-19 21:12:49 +0000 | 
| commit | b820ab01df064df0c5e2936e78c8765a3eb6e446 (patch) | |
| tree | 93fedb55095b77492ead84f7f64a11ad9e25a92e | |
| parent | 4f2bc2345b99c4d0c187aae4f68f4509e50826a5 (diff) | |
Added function to request the HID record
| -rw-r--r-- | input/input-service.c | 50 | 
1 files changed, 42 insertions, 8 deletions
| diff --git a/input/input-service.c b/input/input-service.c index 19778c22..70d2a3f3 100644 --- a/input/input-service.c +++ b/input/input-service.c @@ -380,6 +380,42 @@ static int get_handles(struct pending_req *pr, const char *uuid,  	return 0;  } +static void hid_record_reply(DBusPendingCall *call, void *data) +{ +	DBusMessage *reply = dbus_pending_call_steal_reply(call); +	struct pending_req *pr = data; +	DBusError derr; +	uint8_t *rec_bin; +	int len, scanned; + +	dbus_error_init(&derr); +	if (dbus_set_error_from_message(&derr, reply)) { +		err_generic(pr->conn, pr->msg, derr.name, derr.message); +		dbus_error_free(&derr); +		goto fail; +	} + +	if (!dbus_message_get_args(reply, &derr, +				DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &rec_bin, &len, +				DBUS_TYPE_INVALID)) { +		err_generic(pr->conn, pr->msg, derr.name, derr.message); +		dbus_error_free(&derr); +		goto fail; +	} + +	if (len == 0) { +		err_failed(pr->conn, pr->msg, "SDP error"); +		goto fail; +	} + +	pr->hid_rec = sdp_extract_pdu(rec_bin, &scanned); +	/* FIXME: parse SDP records */ +fail: +	pending_req_free(pr); +	dbus_message_unref(reply); +	dbus_pending_call_unref(call); +} +  static void hid_handle_reply(DBusPendingCall *call, void *data)  {  	DBusMessage *reply = dbus_pending_call_steal_reply(call); @@ -404,14 +440,13 @@ static void hid_handle_reply(DBusPendingCall *call, void *data)  		goto fail;  	} -	if (len == 0) { -		err_failed(pr->conn, pr->msg, "SDP error"); -		goto fail; -	} else { -		info("FIXME: request HID record"); +	if (len != 0) { +		if (get_record(pr, *phandle, hid_record_reply) < 0) +			error("HID record search error"); +		else +			goto done;  	} - -	goto done; +	err_failed(pr->conn, pr->msg, "SDP error");  fail:  	pending_req_free(pr);  done: @@ -458,7 +493,6 @@ done:  	dbus_pending_call_unref(call);  } -  static void pnp_handle_reply(DBusPendingCall *call, void *data)  {  	DBusMessage *reply = dbus_pending_call_steal_reply(call); | 
