* [PATCH v2 1/1] Makes extract_svclass_uuid function public
From: Elvis Pfützenreuter @ 2010-05-13 15:08 UTC (permalink / raw)
To: linux-bluetooth; +Cc: epx
This patch makes the extract_svclass_uuid function public,
so it may be used by applications that link to libbluetooth.
---
lib/sdp.c | 8 ++++----
lib/sdp_lib.h | 1 +
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/lib/sdp.c b/lib/sdp.c
index aa22c63..fb8ccdc 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -591,7 +591,7 @@ sdp_data_t *sdp_seq_alloc(void **dtds, void **values, int len)
return sdp_data_alloc(SDP_SEQ8, seq);
}
-static void extract_svclass_uuid(sdp_data_t *data, uuid_t *uuid)
+void sdp_extract_svclass_uuid(sdp_data_t *data, uuid_t *uuid)
{
sdp_data_t *d;
@@ -619,7 +619,7 @@ int sdp_attr_add(sdp_record_t *rec, uint16_t attr, sdp_data_t *d)
rec->attrlist = sdp_list_insert_sorted(rec->attrlist, d, sdp_attrid_comp_func);
if (attr == SDP_ATTR_SVCLASS_ID_LIST)
- extract_svclass_uuid(d, &rec->svclass);
+ sdp_extract_svclass_uuid(d, &rec->svclass);
return 0;
}
@@ -978,7 +978,7 @@ void sdp_attr_replace(sdp_record_t *rec, uint16_t attr, sdp_data_t *d)
rec->attrlist = sdp_list_insert_sorted(rec->attrlist, d, sdp_attrid_comp_func);
if (attr == SDP_ATTR_SVCLASS_ID_LIST)
- extract_svclass_uuid(d, &rec->svclass);
+ sdp_extract_svclass_uuid(d, &rec->svclass);
}
int sdp_attrid_comp_func(const void *key1, const void *key2)
@@ -1478,7 +1478,7 @@ sdp_record_t *sdp_extract_pdu(const uint8_t *buf, int bufsize, int *scanned)
rec->handle = data->val.uint32;
if (attr == SDP_ATTR_SVCLASS_ID_LIST)
- extract_svclass_uuid(data, &rec->svclass);
+ sdp_extract_svclass_uuid(data, &rec->svclass);
extracted += n;
p += n;
diff --git a/lib/sdp_lib.h b/lib/sdp_lib.h
index e506ac1..3d70f0e 100644
--- a/lib/sdp_lib.h
+++ b/lib/sdp_lib.h
@@ -167,6 +167,7 @@ sdp_data_t *sdp_seq_alloc(void **dtds, void **values, int len);
sdp_data_t *sdp_seq_alloc_with_length(void **dtds, void **values, int *length, int len);
sdp_data_t *sdp_seq_append(sdp_data_t *seq, sdp_data_t *data);
+void sdp_extract_svclass_uuid(sdp_data_t *data, uuid_t *uuid);
int sdp_attr_add(sdp_record_t *rec, uint16_t attr, sdp_data_t *data);
void sdp_attr_remove(sdp_record_t *rec, uint16_t attr);
void sdp_attr_replace(sdp_record_t *rec, uint16_t attr, sdp_data_t *data);
--
1.7.0.4
^ permalink raw reply related
* Re: [PATCH 1/1] Makes extract_svclass_uuid function public
From: Elvis Pfützenreuter @ 2010-05-13 15:00 UTC (permalink / raw)
To: Johan Hedberg; +Cc: linux-bluetooth
In-Reply-To: <20100513145202.GA4699@jh-x301>
I am working in SDP record parsing for HDP plug-in and needed this one (option is of course implement a static function that does the same).
I will prefix that and resubmit.
On 13/05/2010, at 11:52, Johan Hedberg wrote:
> Hi,
>
> On Thu, May 13, 2010, Elvis Pfützenreuter wrote:
>> This patch makes the extract_svclass_uuid function public,
>> so it may be used by applications that link to libbluetooth.
>
> If it's public it needs to be prefixed with sdp_. What's the usecase
> where you need this?
>
> Johan
^ permalink raw reply
* Re: [PATCH 1/1] Makes extract_svclass_uuid function public
From: Johan Hedberg @ 2010-05-13 14:52 UTC (permalink / raw)
To: Elvis Pfützenreuter; +Cc: linux-bluetooth
In-Reply-To: <1273757940-11045-1-git-send-email-epx@signove.com>
Hi,
On Thu, May 13, 2010, Elvis Pfützenreuter wrote:
> This patch makes the extract_svclass_uuid function public,
> so it may be used by applications that link to libbluetooth.
If it's public it needs to be prefixed with sdp_. What's the usecase
where you need this?
Johan
^ permalink raw reply
* [PATCH 1/1] Makes extract_svclass_uuid function public
From: Elvis Pfützenreuter @ 2010-05-13 13:39 UTC (permalink / raw)
To: linux-bluetooth; +Cc: epx
This patch makes the extract_svclass_uuid function public,
so it may be used by applications that link to libbluetooth.
---
lib/sdp.c | 2 +-
lib/sdp_lib.h | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/sdp.c b/lib/sdp.c
index aa22c63..4d65573 100644
--- a/lib/sdp.c
+++ b/lib/sdp.c
@@ -591,7 +591,7 @@ sdp_data_t *sdp_seq_alloc(void **dtds, void **values, int len)
return sdp_data_alloc(SDP_SEQ8, seq);
}
-static void extract_svclass_uuid(sdp_data_t *data, uuid_t *uuid)
+void extract_svclass_uuid(sdp_data_t *data, uuid_t *uuid)
{
sdp_data_t *d;
diff --git a/lib/sdp_lib.h b/lib/sdp_lib.h
index e506ac1..04bad1f 100644
--- a/lib/sdp_lib.h
+++ b/lib/sdp_lib.h
@@ -167,6 +167,7 @@ sdp_data_t *sdp_seq_alloc(void **dtds, void **values, int len);
sdp_data_t *sdp_seq_alloc_with_length(void **dtds, void **values, int *length, int len);
sdp_data_t *sdp_seq_append(sdp_data_t *seq, sdp_data_t *data);
+void extract_svclass_uuid(sdp_data_t *data, uuid_t *uuid);
int sdp_attr_add(sdp_record_t *rec, uint16_t attr, sdp_data_t *data);
void sdp_attr_remove(sdp_record_t *rec, uint16_t attr);
void sdp_attr_replace(sdp_record_t *rec, uint16_t attr, sdp_data_t *data);
--
1.7.0.4
^ permalink raw reply related
* [PATCH] Avoid multiple inclusions of adapter.h
From: Jose Antonio Santos Cadenas @ 2010-05-13 10:38 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jose Antonio Santos Cadenas
---
src/adapter.h | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/adapter.h b/src/adapter.h
index 9b4ce10..8812ed8 100644
--- a/src/adapter.h
+++ b/src/adapter.h
@@ -22,6 +22,9 @@
*
*/
+#ifndef __ADAPTER_H__
+#define __ADAPTER_H__
+
#include <bluetooth/bluetooth.h>
#include <dbus/dbus.h>
#include <glib.h>
@@ -183,3 +186,5 @@ struct btd_adapter_ops {
int btd_register_adapter_ops(struct btd_adapter_ops *btd_adapter_ops);
void btd_adapter_cleanup_ops(struct btd_adapter_ops *btd_adapter_ops);
int adapter_ops_setup(void);
+
+#endif /* __ADAPTER_H__ */
--
1.6.3.3
^ permalink raw reply related
* Re: HDP proposed API (ver 0.3)
From: José Antonio Santos Cadenas @ 2010-05-13 8:02 UTC (permalink / raw)
To: João Paulo Rechi Vita
Cc: linux-bluetooth, Elvis Pfützenreuter, Santiago Carot,
Raul Herbster
In-Reply-To: <AANLkTilxSqkcpovtfgB9WntnB0UEIf3DdZAmobbrAiUK@mail.gmail.com>
Hi João,
Thank you very much for you comments :)
El Thursday 13 May 2010 00:03:51 João Paulo Rechi Vita escribió:
> Hello Jose!
>
> On Wed, May 12, 2010 at 06:26, José Antonio Santos Cadenas
>
> <jcaden@libresoft.es> wrote:
> > This api is a clean up of the previous one the changes.
> >
> > We've added a new object that uses device path to get the sessions
> > allocated on this device (as somebody recommended in other thread,
> > I think Luiz, Elvis or both, but I can't find the exact email). The
> > discovery of new remote session should be done using device drivers,
> > which is compliant with the BlueZ style.
> >
> > Discussions still in progress:
> >
> > - Fd-passing issue: As Elvis, Santiago and I discussed yesterday on
> > IRC we think that the best propose is as follows (please Elvis correct
> > me if I misunderstood something yesterday):
> > Reconnections should be implicit and the data channel should
> > be perceived by the application layer as connected all the time.
> > When the application tries to write in a closed data channel, HDP
> > will perform the data channel reconnection and if it fails, then the
> > channel will be present as closed.
> > The implementation for this this behaviour will use pipes. Each
> > data channel will use 2 pipes to do fd-passing to the application. The
> > upper layer will write in this pipes and HDP will redirect it through
> > the l2cap socket, in this operation, HDP can reconnect if th l2cap
> > socket is closed.
> >
> > - Sessions issues: We still think that session are necessary because they
> > are mentioned in the standard and in the whitepaper and we think that
> > bluez should follow the standards in order to pass PTS for allow
> > Bluetooth SIG certifications. Any comment in this respect are welcome to
> > improve the API usability and conformity with Bluez APIs.
> >
> > - Paths issues: It will be great to find names and paths that are good
> > for everybody, comments and suggestion on this respect are also welcome.
> >
> > I hope we can fix this API asap. All comments or ideas are welcome.
>
> It would be much better if you could bring this API near to other
> BlueZ APIs. All comments I'll do right now is regarding this matter.
>
> > Regards.
> >
> > --------------------------------------------------
> >
> > BlueZ D-Bus HDP API description
> > ***********************************
> >
> > Santiago Carot-Nemesio <sancane@gmail.com>
> > José Antonio Santos-Cadenas <santoscadenas@gmail.com>
> > Elvis Pfützenreuter <epx@signove.com>
> >
> > Health Device Profile hierarchy
> > ===============================
> >
> > Service org.bluez
> > Interface org.bluez.Hdp
>
> If you look on other profile interfaces you'll see that we never use
> the profile acronym for interface names, but the content type (and
> role, where applicable). So this will be better as org.bluez.Health.
>
> Moreover, I see you're using the same interface name to describe two
> different interfaces. This is just wrong. An interface should be a
> description of an unique group of methods and signals signatures. You
> can refer to [0] for a description on interfaces.
>
> [0] http://dbus.freedesktop.org/doc/dbus-tutorial.html#interfaces
Ok, regarding the above comments, this interface changes to:
Interface org.bluez.HealthAdapter
>
> > Object path [variable prefix]/{hci0,hci1,...}
> >
> > Methods object CreateSession(object path, dict config)
> >
> > Returns the object path for the new HDP session.
> > The path parameter is the path of the remote
> > object with the callbacks to notify events (see
> > org.bluez.HdpAgent at the end of this document)
> > This petition starts an mcap session and also
> > register in the SDP is needed
> > Dict is defined as bellow:
> > { "data_spec" : The data_spec is the data exchange
> > specification (see section 5.2.10
> > of the specification document) possible values:
> > 0x00 = reserved,
> > 0x01 [IEEE 11073-20601],
> > 0x02..0xff reserved,
> > (optional)
> > "end_points" : [{ (optional)
> > "mdepid" : uint8, (optional)
> > "role" : ("source" or "sink"), (mandatory)
> > "specs" :[{ (mandatory)
> > "data_type" : uint16, (mandatory)
> > "description" : string, (optional)
> > }]
> > }]
> > }
>
> Couldn't this be moved as properties on the session object? So after
> creating a session you just go on it's object path and set the desired
> properties with SetProperty(). This will be much more aligned with
> other BlueZ APIs.
We thought about doing something similar to this you propose, but we see some
promen, that makes the API more difficult to use:
- Session will need another method in order to start it once you have
configured it. With this method, configuration and session start are done in
just one method call. This implies that the other methods (connect and
disconnect to a remote session) could not be called until the session is
started, this quite strange.
- As you can see, the dictionary has only two members, "data_spec" and
"end_points". So, you will have to pass a dictionary to set end_points too.
>
> > if "data_spec" is not set, no SDP record will be
> > registered, so all the other data in the
> > dictionary will be ignored
> >
> > Session will be closed by the call or implicitly
> > when the programs leaves the bus.
> >
> > Possible errors: org.bluez.Error.InvalidArguments
> >
> > void CloseSession(object path)
> >
> > Closes the HDP session identified by the object
> > path. Also session will be closed if the process that started it is
> > removed from the D-Bus.
>
> s/D-Bus/bus. Also, would be good to keep the description consistent
> between methods. Previous description says "the programs leaves" and
> here "process is removed". IMHO "the process leaves the bus" will be
> the more accurate.
Ok, I'll try to be more consistent in the next revision, using the text that
you suggested.
>
> > Possible errors: org.bluez.Error.InvalidArguments
> > org.bluez.Error.NotFound
> >
> > -------------------------------------------------------------------------
> > -------
> >
> > Service org.bluez
> > Interface org.bluez.Hdp
Chage this to:
Interface org.bluez.HdpDevice
> > Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX
> >
> > Methods array GetSessions()
>
> It would be better if this method return the session object path, then
> you can get this information with GetProperties() on the session
> object.
Do you mean creating a new object that holds the remote sessions?
Right now the org.bluez.HdpSession Objects holds only local sessions. Remote
session will be a bit different. See below.
>
> > Gets the information of the remote sessions
> > present in this device and published on its SDP record. The returned
> > data follows this format.
> >
> > [{"session_id": "a session identification as
> > string", "data_spec" : session data spec,
> > "end_points":
> > ["mdepid": uint8,
> > "role" : "source" or "sink" ,
> > "specs" : [{
> > "dtype" : uint16,
> > "description" : string,
> > (optional) }]
> > ]
> > }]
> >
> > -------------------------------------------------------------------------
> > -------
> >
> > Service org.bluez
> > Interface org.bluez.HdpSession
> > Object path [variable prefix]/{hci0,hci1,...}/{hdp0,hdp1,...}
>
> From the previous interface (the one that defines the GetSessions()
> method) it seems that sessions are tied to a specific device. If so,
> the session objects should be under the device object, not under the
> adapter object.
See below the Session explanation.
>
> > object Connect(remote_session_id)
> >
> > Connects with the remote session and returns its
> > object path.
> >
> > Possible errors: org.bluez.Error.InvalidArguments
> > org.bluez.Error.HdpError
> >
> > void Disconnect(object device, boolean delete)
> >
> > Disconnect from the remote device. If delete is
> > true, any status will also be deleted. Otherwise, the status will be
> > kept for allowing future reconnections.
> >
> > Possible errors: org.bluez.Error.InvalidArguments
> > org.bluez.Error.NotFound
> > org.bluez.Error.HdpError
> >
> > -------------------------------------------------------------------------
> > -------
> >
> > Service org.bluez
> > Interface org.bluez.HdpRemoteSession
> > Object path [variable
> > prefix]/{hci0,hci1,...}/{hdp0,hdp1,...}/rem_session_id
>
> Could you please elaborate more on what does HdpSession and
> HdpRemoteSessions tries to abstract? It still not clear to me and
> depending on this we may find a better name for it.
I think that the most estrange part of the protocol is this and I failed with
my explanations.
HDP uses MCAP that uses what we called "sessions" in the MCAP standard the
called them instances (refer to section 2.1.7 of the MCAP specification for
more details).
A MCAP session/instance is just a tuple of two PSM waiting for connections one
for control channels (mcl) and the other for data channels (mdl) this session
can connect to a remote MCAP session or be connected by them, this connections
is called mcap control link (mcl). Just one connection between two instances
can be established.
As HDP uses MCAP, HDP inherits this "session" behaviour. Each HDP session
starts a MCAP session and also could create a SDP record (mandatory for sinks)
to anounce its attributes (mdeps, psms) to other devices.
The thing that we called HdpSession is a MCAP session (PSM's waiting for
connections) created locally and, optionally a SDP record. HdpSession can
connect to other devices' sessions.
The thing that we called HdpRemoteSession represents a connection between a
local session and a session in other device, in other words is a extension of
a MCAP mcl.
>
> > boolean Echo(array{byte})
> >
> > Sends an echo petition to the remote session.
> > Return True if response matches with the buffer sent. If some error is
> > detected False value is returned and the associated MCL is closed.
> >
> > uint16 OpenDataChannel(byte mdepid, byte config)
> >
> > Creates a new data channel with the indicated
> > config to the remote MCAP Data End Point (MDEP). The configuration
> > should indicate the channel quality of service.
> > Returns the data channel id.
> >
> > Possible errors: org.bluez.Error.InvalidArguments
> > org.bluez.Error.HdpError
> >
> > array GetDcFd(uint16 mdlid)
> >
> > Gets a file descriptor where data can be read or
> > written for receive or sent by the data channel.
> > Returns an array of file descriptors one for write
> > and other for read.
> >
> > Possible errors: org.bluez.Error.InvalidArguments
> > org.bluez.Error.NotFound
> > org.bluez.Error.HdpError
> >
> > void DeleteDataChannel(uint16 mdlid)
> >
> > Deletes a data channel so it will not be available
> > for use.
> >
> > Possible errors: org.bluez.Error.InvalidArguments
> > org.bluez.Error.NotFound
> > org.bluez.Error.HdpError
> >
> > void DeleteAllDataChannels()
> >
> > Deletes all data channels so it will not be
> > available for use. Typically this function is called when the connection
> > with the remote device will be closed permanently
> >
> > Possible errors: org.bluez.Error.HdpError
> >
> > dict GetDataChannelStatus()
> >
> > Return a dictionary with all the data channels
> > that can be used to send data right now. The dictionary is formed like
> > follows:
> > {
> > "reliable": [id1, ..., idz],
> > "best_effort" : [idx, ..., idy]
> > }
> >
> > The fist reliable data channel will always be the
> > first data channel in reliable array.
> >
> > HDPAgent hierarchy
> > ==================
> >
> > (this object is implemented by the HDP client an receives notifications)
> >
> > Service unique name
> > Interface org.bluez.HdpAgent
> > Object path freely definable
> >
> > void DeviceConnected(object path)
> >
> > This method is called whenever a new device
> > connection has been established over the control channel of the current
> > HDP session. The object path contains the object path of the remote
> > device.
> >
> > void DeviceDisconnected(object path)
> >
> > This method is called when a remote device is
> > disconnected definitively. Any future
> > reconnections will fail. Also all data channels associated to this
> > device will be closed.
> >
> > void CreatedDataChannel(object path, uint16 mdlid)
> >
> > This method is called when a new data channel is
> > created The path contains the object path of the device whith the new
> > connection is created and the mdlid the data channel identificator.
> >
> > void DeletedDataChannel(object path, uint16 mdlid)
> >
> > This method is called when a data channel is
> > closed. After this call the data channel will not be valid and can be
> > reused for future created data channels.
^ permalink raw reply
* Re: FTP problem during obexd initialization?
From: Simon @ 2010-05-13 7:02 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <AANLkTiklu7yRsbmNbOgSW2b4LobLlguxnJxxMpi_k_sp@mail.gmail.com>
Most probably some other obex instance has occupied the same address,
eg. obex-data-server.
Thanks!
2010/5/13 Daniel Abraham <daniel.shrugged@gmail.com>:
> Whenever I start obexd 0.23 (on Fedora 12 with BlueZ 4.64) with the -f
> argument (FTP), I see the following log message:
>
> "obexd[...]: Bluetooth server register failed: rfcomm_bind: Address
> already in use (98)"
>
> happens only with FTP, and regardless whether I specify other
> protocols (e.g. e/o/p/s).
>
> Is that indicative or a real problem, or just a harmless log message?
>
> Thanks
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: obexd OPP pull problem
From: Vinicius Gomes @ 2010-05-13 1:00 UTC (permalink / raw)
To: Daniel Abraham; +Cc: Luiz Augusto von Dentz, linux-bluetooth
In-Reply-To: <AANLkTikhFOl6UiI6BN5-xunik9w0FJwW_a7FMbm0-vq7@mail.gmail.com>
Hi Daniel,
First, thanks for the interesting bug report.
On Wed, May 12, 2010 at 6:21 PM, Daniel Abraham
<daniel.shrugged@gmail.com> wrote:
> On Tue, Apr 27, 2010 at 2:51 PM, Daniel Abraham
> <daniel.shrugged@gmail.com> wrote:
>> On Tue, Apr 27, 2010 at 11:33 AM, Luiz Augusto von Dentz
>> <luiz.dentz@gmail.com> wrote:
>>>
>>> This should fix at least the D-Bus error:
>>>
>>> http://gitorious.org/obexd/vudentzs-clone/commit/32e48446b6b8cd72e15988c673a60c7fb47b0862
>>
>> Actually, that's not what I see. I'm using the "pull-business-card"
>> script (which doesn't use any try-except block), and it doesn't crash
>> with an exception, even though "dbus-monitor --session" shows the
>> error (below). Is it lost somehow before it reaches Python's D-Bus
>> caller object?
>>
>> method call sender=:1.147 -> dest=:1.142 serial=4 path=/;
>> interface=org.openobex.Client; member=PullBusinessCard
>> array [
>> dict entry(
>> string "Destination"
>> variant string "00:1C:26:FC:15:AF"
>> )
>> ]
>> string "d.vcf"
>> method call sender=:1.142 -> dest=org.freedesktop.DBus serial=18
>> path=/org/freedesktop/DBus; interface=org.freedesktop.DBus;
>> member=AddMatch
>> string "type='signal',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0=':1.147'"
>> method return sender=:1.142 -> dest=:1.147 reply_serial=4
>> error sender=:1.142 -> dest=:1.147
>> error_name=org.openobex.Error.Failed reply_serial=4
>> string "Method not allowed"
>> method call sender=:1.142 -> dest=org.freedesktop.DBus serial=21
>> path=/org/freedesktop/DBus; interface=org.freedesktop.DBus;
>> member=RemoveMatch
>> string "type='signal',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0=':1.147'"
>> signal sender=org.freedesktop.DBus -> dest=(null destination)
>> serial=10 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus;
>> member=NameOwnerChanged
>> string ":1.147"
>> string ":1.147"
>> string ""
>
> I revisited the issue above, and a problem still reproduces, sorta...
>
> I use the following setup: Fedora 12, BlueZ 4.64, obexd 0.23 on both sides.
> And after a while "PullBusinessCard" started to work, i.e. I pull the
> default vcard (of 50 bytes) from 1 side to the other.
>
> But... Even though the HCI dump shows that the text passed through,
> the vCard file isn't found anywhere.
>
> Also, it looks as if there's some timing issue:
> 1. If I pull a 50-byte card, the remote computer recognize successful
> completion event
> 2. If I pull a 20-KB card, the remote computer doesn't recognize any
> completion event
>
> Either way, the local computer claims to be successful, even though
> there's no saved vcard file.
>
> Another thing I noticed is that the remote host from which I try to
> pull the vcard (also BlueZ 4.64 + obexd 0.23) writes this in
> "/var/log/messages":
>
> obexd[...] New connection from: <BD address>, channel <...>
> (and immediately, with the same timestamp:)
> obexd[...] obexd_handle_input: poll event HUP ERR
>
> I'm also attaching 2 hcidumps (saved on the local computer trying to
> do the pulling).
>
> Any idea how to work around these failures?
I requested a proposed fix to be merged upstream, it is here[1] on the
for-upstream branch. I also set up a 0.23-patched branch that has
those fixes on top of the 0.23 tag, if it makes your life any easier.
But this last option is not even compile tested ;-)
>
> Thanks
>
Cheers,
--
Vinicius
[1] http://git.infradead.org/users/vcgomes/obexd.git
^ permalink raw reply
* Re: HDP proposed API (ver 0.3)
From: João Paulo Rechi Vita @ 2010-05-12 22:03 UTC (permalink / raw)
To: jcaden
Cc: linux-bluetooth, Elvis Pfützenreuter, Santiago Carot,
Raul Herbster
In-Reply-To: <201005121126.12859.jcaden@libresoft.es>
SGVsbG8gSm9zZSEKCk9uIFdlZCwgTWF5IDEyLCAyMDEwIGF0IDA2OjI2LCBKb3PDqSBBbnRvbmlv
IFNhbnRvcyBDYWRlbmFzCjxqY2FkZW5AbGlicmVzb2Z0LmVzPiB3cm90ZToKPiBUaGlzIGFwaSBp
cyBhIGNsZWFuIHVwIG9mIHRoZSBwcmV2aW91cyBvbmUgdGhlIGNoYW5nZXMuCj4KPiBXZSd2ZSBh
ZGRlZCBhIG5ldyBvYmplY3QgdGhhdCB1c2VzIGRldmljZSBwYXRoIHRvIGdldCB0aGUgc2Vzc2lv
bnMKPiBhbGxvY2F0ZWQgb24gdGhpcyBkZXZpY2UgKGFzIHNvbWVib2R5IHJlY29tbWVuZGVkIGlu
IG90aGVyIHRocmVhZCwKPiBJIHRoaW5rIEx1aXosIEVsdmlzIG9yIGJvdGgsIGJ1dCBJIGNhbid0
IGZpbmQgdGhlIGV4YWN0IGVtYWlsKS4gVGhlIGRpc2NvdmVyeQo+IG9mIG5ldyByZW1vdGUgc2Vz
c2lvbiBzaG91bGQgYmUgZG9uZSB1c2luZyBkZXZpY2UgZHJpdmVycywgd2hpY2ggaXMKPiBjb21w
bGlhbnQgd2l0aCB0aGUgQmx1ZVogc3R5bGUuCj4KPiBEaXNjdXNzaW9ucyBzdGlsbCBpbiBwcm9n
cmVzczoKPgo+IC0gRmQtcGFzc2luZyBpc3N1ZTogQXMgRWx2aXMsIFNhbnRpYWdvIGFuZCBJIGRp
c2N1c3NlZCB5ZXN0ZXJkYXkgb24KPiBJUkMgd2UgdGhpbmsgdGhhdCB0aGUgYmVzdCBwcm9wb3Nl
IGlzIGFzIGZvbGxvd3MgKHBsZWFzZ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hQ2hhbm5lbChvYmplY3QgcGF0aCwgdWludDE2IG1kbGlkKQo+Cj4gwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgwqAgwqAgwqAgwqBUaGlzIG1ldGhvZCBpcyBjYWxsZWQgd2hlbiBhIGRhdGEgY2hh
bm5lbCBpcyBjbG9zZWQuCj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBBZnRl
ciB0aGlzIGNhbGwgdGhlIGRhdGEgY2hhbm5lbCB3aWxsIG5vdCBiZSB2YWxpZCBhbmQKPiDCoCDC
oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoGNhbiBiZSByZXVzZWQgZm9yIGZ1dHVyZSBj
cmVhdGVkIGRhdGEgY2hhbm5lbHMuCj4gLS0KPiBUbyB1bnN1YnNjcmliZSBmcm9tIHRoaXMgbGlz
dDogc2VuZCB0aGUgbGluZSAidW5zdWJzY3JpYmUgbGludXgtYmx1ZXRvb3RoIiBpbgo+IHRoZSBi
b2R5IG9mIGEgbWVzc2FnZSB0byBtYWpvcmRvbW9Admdlci5rZXJuZWwub3JnCj4gTW9yZSBtYWpv
cmRvbW8gaW5mbyBhdCDCoGh0dHA6Ly92Z2VyLmtlcm5lbC5vcmcvbWFqb3Jkb21vLWluZm8uaHRt
bAo+CgoKCi0tIApKb8OjbyBQYXVsbyBSZWNoaSBWaXRhCmh0dHA6Ly9qcHJ2aXRhLndvcmRwcmVz
cy5jb20vCg==
^ permalink raw reply
* [PATCH] Bluetooth: Stop ack_timer if ERTM enters in Local Busy or SREJ_SENT
From: Gustavo F. Padovan @ 2010-05-12 21:59 UTC (permalink / raw)
To: linux-bluetooth; +Cc: marcel, gustavo, jprvita
In-Reply-To: <1273633558-10576-6-git-send-email-padovan@profusion.mobi>
The ack_timer is implemation specific, disabling it in such situation
avoids some potencial errors in the ERTM protocol.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
---
net/bluetooth/l2cap.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index 2192b9c..b061108 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -3633,6 +3633,8 @@ static int l2cap_push_rx_skb(struct sock *sk, struct sk_buff *skb, u16 control)
pi->conn_state |= L2CAP_CONN_RNR_SENT;
+ del_timer(&pi->ack_timer);
+
queue_work(_busy_wq, &pi->busy_work);
return err;
@@ -3882,6 +3884,8 @@ static inline int l2cap_data_channel_iframe(struct sock *sk, u16 rx_control, str
pi->conn_state |= L2CAP_CONN_SEND_PBIT;
l2cap_send_srejframe(sk, tx_seq);
+
+ del_timer(&pi->ack_timer);
}
return 0;
--
1.6.4.4
^ permalink raw reply related
* FTP problem during obexd initialization?
From: Daniel Abraham @ 2010-05-12 21:28 UTC (permalink / raw)
To: linux-bluetooth
Whenever I start obexd 0.23 (on Fedora 12 with BlueZ 4.64) with the -f
argument (FTP), I see the following log message:
"obexd[...]: Bluetooth server register failed: rfcomm_bind: Address
already in use (98)"
happens only with FTP, and regardless whether I specify other
protocols (e.g. e/o/p/s).
Is that indicative or a real problem, or just a harmless log message?
Thanks
^ permalink raw reply
* obexd question - default vcard path
From: Daniel Abraham @ 2010-05-12 21:24 UTC (permalink / raw)
To: linux-bluetooth
Is there any way to configure obexd to use a custom path instead of
"/etc/obex/vcard.vcf"?
(When starting obexd, or preferably some configuration/call during runtime?)
Thanks
^ permalink raw reply
* Re: obexd OPP pull problem
From: Daniel Abraham @ 2010-05-12 21:21 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <q2z2c3916b71004270451r957e5befp631d413d4f316afe@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3003 bytes --]
On Tue, Apr 27, 2010 at 2:51 PM, Daniel Abraham
<daniel.shrugged@gmail.com> wrote:
> On Tue, Apr 27, 2010 at 11:33 AM, Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
>>
>> This should fix at least the D-Bus error:
>>
>> http://gitorious.org/obexd/vudentzs-clone/commit/32e48446b6b8cd72e15988c673a60c7fb47b0862
>
> Actually, that's not what I see. I'm using the "pull-business-card"
> script (which doesn't use any try-except block), and it doesn't crash
> with an exception, even though "dbus-monitor --session" shows the
> error (below). Is it lost somehow before it reaches Python's D-Bus
> caller object?
>
> method call sender=:1.147 -> dest=:1.142 serial=4 path=/;
> interface=org.openobex.Client; member=PullBusinessCard
> array [
> dict entry(
> string "Destination"
> variant string "00:1C:26:FC:15:AF"
> )
> ]
> string "d.vcf"
> method call sender=:1.142 -> dest=org.freedesktop.DBus serial=18
> path=/org/freedesktop/DBus; interface=org.freedesktop.DBus;
> member=AddMatch
> string "type='signal',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0=':1.147'"
> method return sender=:1.142 -> dest=:1.147 reply_serial=4
> error sender=:1.142 -> dest=:1.147
> error_name=org.openobex.Error.Failed reply_serial=4
> string "Method not allowed"
> method call sender=:1.142 -> dest=org.freedesktop.DBus serial=21
> path=/org/freedesktop/DBus; interface=org.freedesktop.DBus;
> member=RemoveMatch
> string "type='signal',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0=':1.147'"
> signal sender=org.freedesktop.DBus -> dest=(null destination)
> serial=10 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus;
> member=NameOwnerChanged
> string ":1.147"
> string ":1.147"
> string ""
I revisited the issue above, and a problem still reproduces, sorta...
I use the following setup: Fedora 12, BlueZ 4.64, obexd 0.23 on both sides.
And after a while "PullBusinessCard" started to work, i.e. I pull the
default vcard (of 50 bytes) from 1 side to the other.
But... Even though the HCI dump shows that the text passed through,
the vCard file isn't found anywhere.
Also, it looks as if there's some timing issue:
1. If I pull a 50-byte card, the remote computer recognize successful
completion event
2. If I pull a 20-KB card, the remote computer doesn't recognize any
completion event
Either way, the local computer claims to be successful, even though
there's no saved vcard file.
Another thing I noticed is that the remote host from which I try to
pull the vcard (also BlueZ 4.64 + obexd 0.23) writes this in
"/var/log/messages":
obexd[...] New connection from: <BD address>, channel <...>
(and immediately, with the same timestamp:)
obexd[...] obexd_handle_input: poll event HUP ERR
I'm also attaching 2 hcidumps (saved on the local computer trying to
do the pulling).
Any idea how to work around these failures?
Thanks
[-- Attachment #2: opp-pull-fail.hcidump --]
[-- Type: application/octet-stream, Size: 6616 bytes --]
[-- Attachment #3: opp-pull-success.hcidump --]
[-- Type: application/octet-stream, Size: 2533 bytes --]
^ permalink raw reply
* Re: [l2cap 6/6] Bluetooth: Only check SAR bits if frame is I-frame
From: João Paulo Rechi Vita @ 2010-05-12 18:36 UTC (permalink / raw)
To: Gustavo F. Padovan; +Cc: linux-bluetooth, marcel, gustavo
In-Reply-To: <1273633558-10576-6-git-send-email-padovan@profusion.mobi>
On Wed, May 12, 2010 at 00:05, Gustavo F. Padovan
<padovan@profusion.mobi> wrote:
> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
> ---
> =C2=A0net/bluetooth/l2cap.c | =C2=A0 =C2=A02 +-
> =C2=A01 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
> index dbd43d1..2192b9c 100644
> --- a/net/bluetooth/l2cap.c
> +++ b/net/bluetooth/l2cap.c
> @@ -4123,7 +4123,7 @@ static inline int l2cap_data_channel(struct l2cap_c=
onn *conn, u16 cid, struct sk
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (l2cap_check_fc=
s(pi, skb))
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0goto drop;
>
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (__is_sar_start(con=
trol))
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (__is_sar_start(con=
trol) && __is_iframe(control))
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0len -=3D 2;
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (pi->fcs =3D=3D=
L2CAP_FCS_CRC16)
> --
> 1.6.4.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth=
" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at =C2=A0http://vger.kernel.org/majordomo-info.html
>
The whole series looks good to me.
--=20
Jo=C3=A3o Paulo Rechi Vita
http://jprvita.wordpress.com/
^ permalink raw reply
* Re: [PATCH 08/25] Profiles using MCAP can close a MCL deciding if it should be cached
From: Raul Herbster @ 2010-05-12 15:11 UTC (permalink / raw)
To: Santiago Carot-Nemesio; +Cc: Santiago Carot-Nemesio, linux-bluetooth
In-Reply-To: <1273676372.3239.21.camel@mosquito>
Hi Santiago,
2010/5/12 Santiago Carot-Nemesio <scarot@libresoft.es>:
> Hello Raul,
>
> El mié, 12-05-2010 a las 11:33 -0300, Raul Herbster escribió:
>> Hi Santiago,
>>
>> 2010/5/10 Santiago Carot-Nemesio <sancane@gmail.com>:
>> > From: Santiago Carot Nemesio <sancane@gmail.com>
>> >
>> > ---
>> > mcap/mcap.c | 17 +++++++++++++++++
>> > 1 files changed, 17 insertions(+), 0 deletions(-)
>> >
>> > diff --git a/mcap/mcap.c b/mcap/mcap.c
>> > index 0112154..8f6fb78 100644
>> > --- a/mcap/mcap.c
>> > +++ b/mcap/mcap.c
>> > @@ -305,6 +305,23 @@ static void mcap_uncache_mcl(struct mcap_mcl *mcl)
>> > mcl->ctrl &= ~MCAP_CTRL_FREE;
>> > }
>> >
>> > +void mcap_close_mcl(struct mcap_mcl *mcl, gboolean cache)
>> > +{
>> > + if (!mcl)
>> > + return;
>> > +
>> > + if (mcl->cc) {
>> > + g_io_channel_shutdown(mcl->cc, TRUE, NULL);
>> > + g_io_channel_unref(mcl->cc);
>> > + mcl->cc = NULL;
>> > + }
>> > +
>> > + mcl->state = MCL_IDLE;
>> > +
>> > + if (!cache)
>> > + mcl->ctrl |= MCAP_CTRL_NOCACHE;
>> > +}
>> > +
>>
>> According to MCAP spec (page 10, section 2.1.2), when the CC is
>> closed, all of its associated DCs are closed as well. In fact, DCs are
>> propely closed on mcap_mcl_free , but not on mcap_close_mcl. So, which
>> one really closes MCL?
>
> That's rigth and if you see the source code, the control channel is
> closed using "shutdown", when above function is called the control
> channel is closed. Then watcher function associated with the control
> channel is executed "mcl_control_cb". Here you will see that MCL is
> closed by calling to "mcap_cache_mcl". At thye end of that function the
> mcl is shutting down (function mcl_shutdown) and control channel and all
> data channels are closed. You can see the code to check that all is
> right.
Ok. I´ve got it and the code is right. The suggestion is just on
function name. mcap_close_mcl does not really closes a MCL,
but "shutdown" does :)
>
> Please, study the code in deep before assert that the code doesn't work,
> of course that it may be errors, but testing and playing with the code
> can help to you to discard false positives.
>
> Regards
>
>> []´s
>> --Raul
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
^ permalink raw reply
* Re: [PATCH 13/25] Process standard op. codes in pending and active state
From: Raul Herbster @ 2010-05-12 15:00 UTC (permalink / raw)
To: Santiago Carot-Nemesio; +Cc: linux-bluetooth
In-Reply-To: <1273486527-7855-13-git-send-email-sancane@gmail.com>
Hi Santiago,
2010/5/10 Santiago Carot-Nemesio <sancane@gmail.com>:
> From: Santiago Carot Nemesio <sancane@gmail.com>
>
> ---
> mcap/mcap.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 61 insertions(+), 2 deletions(-)
>
> diff --git a/mcap/mcap.c b/mcap/mcap.c
> index 7aeefb2..6d548b9 100644
> --- a/mcap/mcap.c
> +++ b/mcap/mcap.c
> @@ -635,6 +635,50 @@ static void process_md_reconnect_mdl_req(struct mcap_mcl *mcl, uint8_t *cmd,
> send4B_cmd(mcl, MCAP_MD_RECONNECT_MDL_RSP, MCAP_SUCCESS, mdl_id);
> }
>
> +static void process_md_abort_mdl_req(struct mcap_mcl *mcl, uint8_t *cmd,
> + uint32_t len)
> +{
> + mcap_md_req *req;
> + GSList *l;
> + struct mcap_mdl *mdl, *del;
> + uint16_t mdl_id;
> +
> + if (len != sizeof(mcap_md_req)) {
> + send4B_cmd(mcl, MCAP_MD_ABORT_MDL_RSP,
> + MCAP_INVALID_PARAM_VALUE, MCAP_MDLID_RESERVED);
> + return;
> + }
> +
> + req = (mcap_md_req *)cmd;
> + mdl_id = ntohs(req->mdl);
> + mcl->state = MCL_CONNECTED;
> + for (l = mcl->mdls; l; l = l->next) {
> + mdl = l->data;
> + if ((mdl_id == mdl->mdlid) && (mdl->state == MDL_WAITING)) {
> + del = mdl;
> + if (mcl->state != MCL_CONNECTED)
> + break;
> + continue;
> + }
> + if ((mdl->state == MDL_CONNECTED) && (mcl->state != MCL_ACTIVE))
> + mcl->state = MCL_ACTIVE;
> +
> + if ((del) && (mcl->state == MCL_ACTIVE))
> + break;
> + }
> +
> + if (!del) {
> + send4B_cmd(mcl, MCAP_MD_ABORT_MDL_RSP, MCAP_INVALID_MDL, mdl_id);
More than 80 characters in line.
[]´s
--Raul
^ permalink raw reply
* Re: [PATCH 08/25] Profiles using MCAP can close a MCL deciding if it should be cached
From: Santiago Carot-Nemesio @ 2010-05-12 14:59 UTC (permalink / raw)
To: Raul Herbster; +Cc: Santiago Carot-Nemesio, linux-bluetooth
In-Reply-To: <AANLkTikhyI_MBRgVAV3CpQ7_bSqUXqKdkarY1VTI_kI-@mail.gmail.com>
Hello Raul,
El mié, 12-05-2010 a las 11:33 -0300, Raul Herbster escribió:
> Hi Santiago,
>
> 2010/5/10 Santiago Carot-Nemesio <sancane@gmail.com>:
> > From: Santiago Carot Nemesio <sancane@gmail.com>
> >
> > ---
> > mcap/mcap.c | 17 +++++++++++++++++
> > 1 files changed, 17 insertions(+), 0 deletions(-)
> >
> > diff --git a/mcap/mcap.c b/mcap/mcap.c
> > index 0112154..8f6fb78 100644
> > --- a/mcap/mcap.c
> > +++ b/mcap/mcap.c
> > @@ -305,6 +305,23 @@ static void mcap_uncache_mcl(struct mcap_mcl *mcl)
> > mcl->ctrl &= ~MCAP_CTRL_FREE;
> > }
> >
> > +void mcap_close_mcl(struct mcap_mcl *mcl, gboolean cache)
> > +{
> > + if (!mcl)
> > + return;
> > +
> > + if (mcl->cc) {
> > + g_io_channel_shutdown(mcl->cc, TRUE, NULL);
> > + g_io_channel_unref(mcl->cc);
> > + mcl->cc = NULL;
> > + }
> > +
> > + mcl->state = MCL_IDLE;
> > +
> > + if (!cache)
> > + mcl->ctrl |= MCAP_CTRL_NOCACHE;
> > +}
> > +
>
> According to MCAP spec (page 10, section 2.1.2), when the CC is
> closed, all of its associated DCs are closed as well. In fact, DCs are
> propely closed on mcap_mcl_free , but not on mcap_close_mcl. So, which
> one really closes MCL?
That's rigth and if you see the source code, the control channel is
closed using "shutdown", when above function is called the control
channel is closed. Then watcher function associated with the control
channel is executed "mcl_control_cb". Here you will see that MCL is
closed by calling to "mcap_cache_mcl". At thye end of that function the
mcl is shutting down (function mcl_shutdown) and control channel and all
data channels are closed. You can see the code to check that all is
right.
Please, study the code in deep before assert that the code doesn't work,
of course that it may be errors, but testing and playing with the code
can help to you to discard false positives.
Regards
> []´s
> --Raul
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 08/25] Profiles using MCAP can close a MCL deciding if it should be cached
From: Raul Herbster @ 2010-05-12 14:33 UTC (permalink / raw)
To: Santiago Carot-Nemesio; +Cc: linux-bluetooth
In-Reply-To: <1273486527-7855-8-git-send-email-sancane@gmail.com>
Hi Santiago,
2010/5/10 Santiago Carot-Nemesio <sancane@gmail.com>:
> From: Santiago Carot Nemesio <sancane@gmail.com>
>
> ---
> mcap/mcap.c | 17 +++++++++++++++++
> 1 files changed, 17 insertions(+), 0 deletions(-)
>
> diff --git a/mcap/mcap.c b/mcap/mcap.c
> index 0112154..8f6fb78 100644
> --- a/mcap/mcap.c
> +++ b/mcap/mcap.c
> @@ -305,6 +305,23 @@ static void mcap_uncache_mcl(struct mcap_mcl *mcl)
> mcl->ctrl &= ~MCAP_CTRL_FREE;
> }
>
> +void mcap_close_mcl(struct mcap_mcl *mcl, gboolean cache)
> +{
> + if (!mcl)
> + return;
> +
> + if (mcl->cc) {
> + g_io_channel_shutdown(mcl->cc, TRUE, NULL);
> + g_io_channel_unref(mcl->cc);
> + mcl->cc = NULL;
> + }
> +
> + mcl->state = MCL_IDLE;
> +
> + if (!cache)
> + mcl->ctrl |= MCAP_CTRL_NOCACHE;
> +}
> +
According to MCAP spec (page 10, section 2.1.2), when the CC is
closed, all of its associated DCs are closed as well. In fact, DCs are
propely closed on mcap_mcl_free , but not on mcap_close_mcl. So, which
one really closes MCL?
[]´s
--Raul
^ permalink raw reply
* Re: [PATCH] HID:magicmouse: This fixes a connection problem with the magicmouse.
From: Justin P. Mattock @ 2010-05-12 14:25 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-bluetooth, linux-kernel, mdpoole
In-Reply-To: <alpine.LNX.2.00.1005121602240.28092@pobox.suse.cz>
On 05/12/2010 07:03 AM, Jiri Kosina wrote:
> On Wed, 12 May 2010, Justin P. Mattock wrote:
>
>
>>>>>> --- a/drivers/hid/hid-magicmouse.c
>>>>>> +++ b/drivers/hid/hid-magicmouse.c
>>>>>> @@ -354,7 +354,7 @@ static int magicmouse_probe(struct hid_device
>>>>>> *hdev,
>>>>>> goto err_free;
>>>>>> }
>>>>>>
>>>>>> - ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT&
>>>>>> ~HID_CONNECT_HIDINPUT);
>>>>>> + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
>>>>>>
>>>>>>
>>>>>>
>>>>> This is not particularly right, as we'll end up having dangling
>>>>> input device.
>>>>>
>>>>> The problem is, that when HIDRAW is not set, hid_hw_start()
>>>>> returns ENODEV as no subsystem has claimed the device, and probe
>>>>> routine bails out. Which is not what we want.
>>>>>
>>>>> Does the testing patch below fix the problems you are seeing?
>>>>>
>>>>>
>>>> works good.. rebooted a few times mouse connects. suspended a few times
>>>> mouse reconnects.
>>>>
>>>>
>>> I'd be glad if you could also double-check that device removal and
>>> re-connecting it works well as well with this patch.
>>>
>>>
>> with test I did different techniques,
>> 1) regular suspend(leave device on)
>> 2)suspend then shut off device
>> 3)shut off device then suspend
>> all of these techniques work properly
>>
> Thanks for reporting and testing, I have queued the patch.
>
>
cool...
Justin P. Mattock
^ permalink raw reply
* Re: [PATCH 07/25] Initiate creation of MCLs
From: Raul Herbster @ 2010-05-12 14:16 UTC (permalink / raw)
To: Santiago Carot-Nemesio; +Cc: linux-bluetooth
In-Reply-To: <1273486527-7855-7-git-send-email-sancane@gmail.com>
Hi Santiago
2010/5/10 Santiago Carot-Nemesio <sancane@gmail.com>:
> From: Santiago Carot Nemesio <sancane@gmail.com>
>
> ---
> mcap/mcap.c | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 115 insertions(+), 0 deletions(-)
>
> diff --git a/mcap/mcap.c b/mcap/mcap.c
> index ebfaf9e..0112154 100644
> --- a/mcap/mcap.c
> +++ b/mcap/mcap.c
> @@ -43,6 +43,12 @@
> __mcl->tid = 0; \
> } while(0)
>
> +struct connect_mcl {
> + struct mcap_mcl *mcl; /* MCL for this operation */
> + mcap_mcl_connect_cb connect_cb; /* Connect callback */
> + gpointer user_data; /* Callback user data */
> +};
> +
> /* MCAP finite state machine functions */
> static void proc_req_connected(struct mcap_mcl *mcl, uint8_t *cmd, uint32_t len);
> static void proc_req_pending(struct mcap_mcl *mcl, uint8_t *cmd, uint32_t len);
> @@ -419,6 +425,115 @@ fail:
> return FALSE;
> }
>
> +static void mcap_connect_mcl_cb(GIOChannel *chan, GError *conn_err,
> + gpointer user_data)
> +{
> + char dstaddr[18];
> + struct connect_mcl *con = user_data;
> + struct mcap_mcl *aux, *mcl = con->mcl;
> + mcap_mcl_connect_cb connect_cb = con->connect_cb;
> + gpointer data = con->user_data;
> + GError *gerr = NULL;
> +
> + g_free(con);
> +
> + mcl->ctrl &= ~MCAP_CTRL_CONN;
> +
> + if (conn_err) {
> + if (mcl->ctrl & MCAP_CTRL_FREE)
> + mcl->ms->mcl_uncached_cb(mcl, mcl->ms->user_data);
> + mcap_mcl_check_del(mcl);
> + connect_cb(NULL, conn_err, data);
> + return;
> + }
> +
> + ba2str(&mcl->addr, dstaddr);
> +
> + aux = find_mcl(mcl->ms->mcls, &mcl->addr);
> + if (aux) {
> + /* Double MCL connection case */
> + if (aux != mcl) {
> + /* This MCL was not in cache */
> + mcap_mcl_unref(mcl);
> + }
> + error("MCL error: Device %s is already connected", dstaddr);
> + g_set_error(&gerr, MCAP_ERROR, MCAP_ERROR_ALREADY_EXISTS,
> + "MCL %s is already connected", dstaddr);
> + connect_cb(NULL, gerr, data);
> + g_error_free(gerr);
> + return;
> + }
> +
> + mcl->state = MCL_CONNECTED;
> + mcl->role = MCL_INITIATOR;
> + mcl->req = MCL_AVAILABLE;
> + mcl->ctrl |= MCAP_CTRL_STD_OP;
> +
> + if (mcl->ctrl & MCAP_CTRL_CACHED)
> + mcap_uncache_mcl(mcl);
> + else
> + mcl->ms->mcls = g_slist_prepend(mcl->ms->mcls, mcl);
> +
> + mcl->wid = g_io_add_watch(mcl->cc, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL,
> + (GIOFunc) mcl_control_cb, mcl);
More than 80 characters.
[]´s
--Raul
^ permalink raw reply
* Re: [PATCH] HID:magicmouse: This fixes a connection problem with the magicmouse.
From: Jiri Kosina @ 2010-05-12 14:03 UTC (permalink / raw)
To: Justin P. Mattock; +Cc: linux-bluetooth, linux-kernel, mdpoole
In-Reply-To: <4BEAB3AF.6020909@gmail.com>
On Wed, 12 May 2010, Justin P. Mattock wrote:
> > > > > --- a/drivers/hid/hid-magicmouse.c
> > > > > +++ b/drivers/hid/hid-magicmouse.c
> > > > > @@ -354,7 +354,7 @@ static int magicmouse_probe(struct hid_device
> > > > > *hdev,
> > > > > goto err_free;
> > > > > }
> > > > >
> > > > > - ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT&
> > > > > ~HID_CONNECT_HIDINPUT);
> > > > > + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
> > > > >
> > > > >
> > > > This is not particularly right, as we'll end up having dangling
> > > > input device.
> > > >
> > > > The problem is, that when HIDRAW is not set, hid_hw_start()
> > > > returns ENODEV as no subsystem has claimed the device, and probe
> > > > routine bails out. Which is not what we want.
> > > >
> > > > Does the testing patch below fix the problems you are seeing?
> > > >
> > > works good.. rebooted a few times mouse connects. suspended a few times
> > > mouse reconnects.
> > >
> > I'd be glad if you could also double-check that device removal and
> > re-connecting it works well as well with this patch.
> >
> with test I did different techniques,
> 1) regular suspend(leave device on)
> 2)suspend then shut off device
> 3)shut off device then suspend
> all of these techniques work properly
Thanks for reporting and testing, I have queued the patch.
--
Jiri Kosina
SUSE Labs, Novell Inc.
^ permalink raw reply
* Re: [PATCH] HID:magicmouse: This fixes a connection problem with the magicmouse.
From: Justin P. Mattock @ 2010-05-12 13:57 UTC (permalink / raw)
To: Jiri Kosina; +Cc: linux-bluetooth, linux-kernel, mdpoole
In-Reply-To: <alpine.LNX.2.00.1005121540340.28092@pobox.suse.cz>
On 05/12/2010 06:41 AM, Jiri Kosina wrote:
> On Wed, 12 May 2010, Justin P. Mattock wrote:
>
>
>>>> --- a/drivers/hid/hid-magicmouse.c
>>>> +++ b/drivers/hid/hid-magicmouse.c
>>>> @@ -354,7 +354,7 @@ static int magicmouse_probe(struct hid_device *hdev,
>>>> goto err_free;
>>>> }
>>>>
>>>> - ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT& ~HID_CONNECT_HIDINPUT);
>>>> + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
>>>>
>>>>
>>> This is not particularly right, as we'll end up having dangling input
>>> device.
>>>
>>> The problem is, that when HIDRAW is not set, hid_hw_start() returns ENODEV
>>> as no subsystem has claimed the device, and probe routine bails out. Which
>>> is not what we want.
>>>
>>> Does the testing patch below fix the problems you are seeing?
>>>
>>>
>>>
>>>
>> works good.. rebooted a few times mouse connects. suspended a few times
>> mouse reconnects.
>>
> I'd be glad if you could also double-check that device removal and
> re-connecting it works well as well with this patch.
>
>
with test I did different techniques,
1) regular suspend(leave device on)
2)suspend then shut off device
3)shut off device then suspend
all of these techniques work properly
(let me know if this is what you meant).
>>> diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
>>> index 0d471fc..f10d56a 100644
>>> --- a/drivers/hid/hid-magicmouse.c
>>> +++ b/drivers/hid/hid-magicmouse.c
>>> @@ -354,12 +354,15 @@ static int magicmouse_probe(struct hid_device *hdev,
>>> goto err_free;
>>> }
>>>
>>> - ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT& ~HID_CONNECT_HIDINPUT);
>>> + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
>>> if (ret) {
>>> dev_err(&hdev->dev, "magicmouse hw start failed\n");
>>> goto err_free;
>>> }
>>>
>>> + /* we are handling the input ourselves */
>>> + hidinput_disconnect(hdev);
>>> +
>>> report = hid_register_report(hdev, HID_INPUT_REPORT, TOUCH_REPORT_ID);
>>> if (!report) {
>>> dev_err(&hdev->dev, "unable to register touch report\n");
>>>
>>>
>>>
>> looks good over here.. If you'd like I can re-du this patch, add your
>> sign off etc.. and re-send, or not worry.. either way this little
>> quirk/problem is fixed.
>>
> No problem, once you confirm that device removal wasn't broken again and
> if I don't hear any objections from Michael, I will queue the patch
> myself.
>
> Thanks,
>
>
alright buddy,
looks good over here.
cheers.
Justin P. Mattock
^ permalink raw reply
* Re: [PATCH] HID:magicmouse: This fixes a connection problem with the magicmouse.
From: Michael Poole @ 2010-05-12 13:54 UTC (permalink / raw)
To: Jiri Kosina; +Cc: Justin P. Mattock, linux-bluetooth, linux-kernel
In-Reply-To: <alpine.LNX.2.00.1005121540340.28092@pobox.suse.cz>
Jiri Kosina writes:
> On Wed, 12 May 2010, Justin P. Mattock wrote:
>
>> > > --- a/drivers/hid/hid-magicmouse.c
>> > > +++ b/drivers/hid/hid-magicmouse.c
>> > > @@ -354,7 +354,7 @@ static int magicmouse_probe(struct hid_device *hdev,
>> > > goto err_free;
>> > > }
>> > >
>> > > - ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT& ~HID_CONNECT_HIDINPUT);
>> > > + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
>> > >
>> > This is not particularly right, as we'll end up having dangling input
>> > device.
>> >
>> > The problem is, that when HIDRAW is not set, hid_hw_start() returns ENODEV
>> > as no subsystem has claimed the device, and probe routine bails out. Which
>> > is not what we want.
>> >
>> > Does the testing patch below fix the problems you are seeing?
>> >
>> >
>> >
>> works good.. rebooted a few times mouse connects. suspended a few times
>> mouse reconnects.
>
> I'd be glad if you could also double-check that device removal and
> re-connecting it works well as well with this patch.
>
>> > diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
>> > index 0d471fc..f10d56a 100644
>> > --- a/drivers/hid/hid-magicmouse.c
>> > +++ b/drivers/hid/hid-magicmouse.c
>> > @@ -354,12 +354,15 @@ static int magicmouse_probe(struct hid_device *hdev,
>> > goto err_free;
>> > }
>> >
>> > - ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT& ~HID_CONNECT_HIDINPUT);
>> > + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
>> > if (ret) {
>> > dev_err(&hdev->dev, "magicmouse hw start failed\n");
>> > goto err_free;
>> > }
>> >
>> > + /* we are handling the input ourselves */
>> > + hidinput_disconnect(hdev);
>> > +
>> > report = hid_register_report(hdev, HID_INPUT_REPORT, TOUCH_REPORT_ID);
>> > if (!report) {
>> > dev_err(&hdev->dev, "unable to register touch report\n");
>> >
>> >
>>
>> looks good over here.. If you'd like I can re-du this patch, add your
>> sign off etc.. and re-send, or not worry.. either way this little
>> quirk/problem is fixed.
>
> No problem, once you confirm that device removal wasn't broken again and
> if I don't hear any objections from Michael, I will queue the patch
> myself.
It looks good to me. Thanks for doing this -- work has been busy this
week, so I haven't had time to dig into the issue yet.
Michael
^ permalink raw reply
* [PATCH v3] hciattach application support for Atheros AR300x Bluetooth Chip
From: suraj @ 2010-05-12 13:47 UTC (permalink / raw)
To: linux-bluetooth; +Cc: marcel, Luis.Rodriguez, Jothikumar.Mothilal
In-Reply-To: <1271927414.1409.3.camel@atheros013-desktop>
Implements support for Atheros AR300x Bluetooth chip in hciattach.
Adds feature to bring up AR300x Bluetooth chip
with and without enhanced power management enabled.
Signed-off-by: Suraj <suraj@Atheros.com>
---
Makefile.tools | 1 +
tools/hciattach.8 | 6 +
tools/hciattach.c | 111 +++++
tools/hciattach.h | 3 +
tools/hciattach_ar3k.c | 1223 ++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 1344 insertions(+), 0 deletions(-)
create mode 100755 tools/hciattach_ar3k.c
diff --git a/Makefile.tools b/Makefile.tools
index 2735d68..48cf097 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -23,6 +23,7 @@ tools_l2ping_LDADD = lib/libbluetooth.la
tools_hciattach_SOURCES = tools/hciattach.c tools/hciattach.h \
tools/hciattach_st.c \
tools/hciattach_ti.c \
+ tools/hciattach_ar3k.c \
tools/hciattach_tialt.c
tools_hciattach_LDADD = lib/libbluetooth.la
diff --git a/tools/hciattach.8 b/tools/hciattach.8
index f750222..ef943ea 100644
--- a/tools/hciattach.8
+++ b/tools/hciattach.8
@@ -49,6 +49,12 @@ specific identifier. Currently supported types are
.B any
Unspecified HCI_UART interface, no vendor specific options
.TP
+.B ar3kalt
+Atheros AR300x based serial bluetooth device with power management disabled
+.TP
+.B ar3k
+Atheros AR300x based serial bluetooth device
+.TP
.B ericsson
Ericsson based modules
.TP
diff --git a/tools/hciattach.c b/tools/hciattach.c
index b13db1b..768a3f1 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -653,6 +653,110 @@ static int csr(int fd, struct uart_t *u, struct termios *ti)
}
/*
+ * Atheros AR300x specific initialization post callback
+ * with power management dsiabled
+ * Suraj Sumangala <Suraj@Atheros.com>
+ */
+static int ar3kpost(int fd, struct uart_t *u, struct termios *ti)
+{
+ return ath_configure_sleep(fd, 0);
+}
+
+/*
+ * Atheros AR300x specific initialization post callback
+ * with power management enabled
+ * Suraj Sumangala <Suraj@Atheros.com>
+ */
+static int ar3kpmpost(int fd, struct uart_t *u, struct termios *ti)
+{
+ return ath_configure_sleep(fd, 1);
+}
+/*
+ * Atheros AR300x specific initialization
+ * Suraj Sumangala <Suraj@Atheros.com>
+ */
+static int ar3kinit(int fd, struct uart_t *u, struct termios *ti)
+{
+ struct timespec tm = { 0, 500000 };
+ unsigned char cmd[14], rsp[100];
+ int r;
+ int baud;
+
+ /* Download PS and patch */
+ r = ath_ps_download(fd);
+
+ if (r < 0) {
+ perror("Failed to Download configuration");
+ return -1;
+ }
+
+ /* Write BDADDR if user has provided any */
+ if (u->bdaddr != NULL) {
+ /* Set BD_ADDR */
+ memset(cmd, 0, sizeof(cmd));
+ memset(rsp, 0, sizeof(rsp));
+ cmd[0] = HCI_COMMAND_PKT;
+ cmd[1] = 0x0B;
+ cmd[2] = 0xfc;
+ cmd[3] = 0x0A;
+ cmd[4] = 0x01;
+ cmd[5] = 0x01;
+ cmd[6] = 0x00;
+ cmd[7] = 0x06;
+ str2ba(u->bdaddr, (bdaddr_t *) (cmd + 8));
+
+ /* Send command */
+ if (write(fd, cmd, 14) != 14) {
+ fprintf(stderr, "Failed to write BD_ADDR command\n");
+ return -1;
+ }
+
+ /* Read reply */
+ if (read_hci_event(fd, rsp, 10) < 0) {
+ fprintf(stderr, "Failed to set BD_ADDR\n");
+ return -1;
+ }
+ }
+
+ /* Send HCI Reset to write the configuration */
+ cmd[0] = HCI_COMMAND_PKT;
+ cmd[1] = 0x03;
+ cmd[2] = 0x0C;
+ cmd[3] = 0x00;
+
+ r = write(fd, cmd, 4);
+
+ if (r != 4)
+ return -1;
+
+ nanosleep(&tm, NULL);
+ if (read_hci_event(fd, rsp, sizeof(rsp)) < 0)
+ return -1;
+
+ /* Set baud rate command,
+ * set controller baud rate to user specified value */
+ cmd[0] = HCI_COMMAND_PKT;
+ cmd[1] = 0x0C;
+ cmd[2] = 0xfc;
+ cmd[3] = 0x02;
+ baud = u->speed/100;
+ cmd[4] = (char)baud;
+ cmd[5] = (char)(baud >> 8);
+
+ if (write(fd, cmd, 6) != 6) {
+ perror("Failed to write init command");
+ return -1;
+ }
+
+ /* Wait for the command complete event for Baud rate change Command */
+ nanosleep(&tm, NULL);
+
+ if (read_hci_event(fd, rsp, sizeof(rsp)) < 0)
+ return -1;
+
+ return 0;
+}
+/*
* Silicon Wave specific initialization
* Thomas Moser <thomas.moser@tmoser.ch>
*/
@@ -1071,6 +1175,13 @@ struct uart_t uart[] = {
/* Broadcom BCM2035 */
{ "bcm2035", 0x0A5C, 0x2035, HCI_UART_H4, 115200, 460800, FLOW_CTL, NULL, bcm2035 },
+ /* ATHEROS AR300x */
+ { "ar3kalt", 0x0000, 0x0000, HCI_UART_ATH, 115200, 115200,
+ FLOW_CTL, NULL, ar3kinit, ar3kpost },
+
+ { "ar3k", 0x0000, 0x0000, HCI_UART_ATH, 115200, 115200,
+ FLOW_CTL, NULL, ar3kinit, ar3kpmpost },
+
{ NULL, 0 }
};
diff --git a/tools/hciattach.h b/tools/hciattach.h
index 867563b..7719e04 100644
--- a/tools/hciattach.h
+++ b/tools/hciattach.h
@@ -36,6 +36,7 @@
#define HCI_UART_3WIRE 2
#define HCI_UART_H4DS 3
#define HCI_UART_LL 4
+#define HCI_UART_ATH 5
int read_hci_event(int fd, unsigned char* buf, int size);
int set_speed(int fd, struct termios *ti, int speed);
@@ -45,3 +46,5 @@ int texas_post(int fd, struct termios *ti);
int texasalt_init(int fd, int speed, struct termios *ti);
int stlc2500_init(int fd, bdaddr_t *bdaddr);
int bgb2xx_init(int dd, bdaddr_t *bdaddr);
+int ath_configure_sleep(int fd, int sleep_stat);
+int ath_ps_download(int fd);
diff --git a/tools/hciattach_ar3k.c b/tools/hciattach_ar3k.c
new file mode 100755
index 0000000..2542161
--- /dev/null
+++ b/tools/hciattach_ar3k.c
@@ -0,0 +1,1223 @@
+/*
+ * Copyright (c) 2009-2010 Atheros Communications Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <time.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/ioctl.h>
+
+#include <bluetooth/bluetooth.h>
+#include <bluetooth/hci.h>
+#include <bluetooth/hci_lib.h>
+
+#include "hciattach.h"
+
+/* The maximum number of bytes possible in a patch entry */
+#define MAX_PATCH_SIZE 20000
+
+#define MAX_BYTE_LENGTH 244
+
+/* Maximum HCI packets that will be formed from the Patch file */
+#define MAX_NUM_PATCH_ENTRY ((MAX_PATCH_SIZE/MAX_BYTE_LENGTH) + 1)
+
+#define DEV_REGISTER 0x4FFC
+
+#define FW_PATH "/lib/firmware/ar3k/"
+
+#define PS_ASIC_FILE "PS_ASIC.pst"
+#define PS_FPGA_FILE "PS_FPGA.pst"
+#define PATCH_FILE "RamPatch.txt"
+#define BDADDR_FILE "ar3kbdaddr.pst"
+
+#define HCI_CMD_HEADER_LEN 7
+
+/* PS command types */
+#define PS_RESET 2
+#define PS_WRITE 1
+#define WRITE_PATCH 8
+#define PS_VERIFY_CRC 9
+#define ENABLE_PATCH 11
+
+#define EXTRA_PATCH_SIZE 500
+
+/* PS configuration entry time */
+#define PS_TYPE_HEX 0
+#define PS_TYPE_DEC 1
+
+#define PS_RESET_PARAM_LEN 6
+#define PS_RESET_CMD_LEN (PS_RESET_PARAM_LEN +\
+ HCI_CMD_HEADER_LEN)
+
+#define RAM_PS_REGION (1<<0)
+#define RAM_PATCH_REGION (1<<1)
+
+#define RAMPS_MAX_PS_TAGS_PER_FILE 50
+#define PS_MAX_LEN 500
+#define LINE_SIZE_MAX (PS_MAX_LEN * 2)
+
+#define BYTES_OF_PS_DATA_PER_LINE 16
+
+#define skip_space(str) while (*(str) == (' ')) ((str)++)
+
+#define is_between(x, lower, upper) (((lower) <= (x)) && ((x) <= (upper)))
+
+#define tohexval(c) (isdigit((c)) ? ((c) - '0') : \
+ (is_between((c), 'A', 'Z') ? \
+ ((c) - 'A' + 10) : ((c) - 'a' + 10)))
+
+#define stringtohex(str) (((uint8_t)(tohexval((str)[0]) << 4)) |\
+ ((uint8_t)tohexval((str)[1])))
+
+#define set_pst_format(pst, type, array_val) ((pst)->data_type = (type),\
+ (pst)->is_array = (array_val))
+
+struct ps_tag_entry {
+ uint32_t tag_id;
+ uint32_t tag_len;
+ uint8_t *tag_data;
+};
+
+struct ps_ram_patch {
+ int16_t Len;
+ uint8_t *Data;
+};
+
+struct ps_data_format {
+ unsigned char data_type;
+ unsigned char is_array;
+};
+
+struct ps_cmd_packet {
+ uint8_t *Hcipacket;
+ int packetLen;
+};
+
+struct st_read_status {
+ unsigned section;
+ unsigned line_count;
+ unsigned char_cnt;
+ unsigned byte_count;
+};
+
+struct ps_tag_entry ps_tag_entry[RAMPS_MAX_PS_TAGS_PER_FILE];
+struct ps_ram_patch ram_patch[MAX_NUM_PATCH_ENTRY];
+
+static void load_hci_header(uint8_t *hci_ps_cmd,
+ uint8_t opcode,
+ int length,
+ int index)
+{
+ hci_ps_cmd[0] = 0x0B;
+ hci_ps_cmd[1] = 0xFC;
+ hci_ps_cmd[2] = length + 4;
+ hci_ps_cmd[3] = opcode;
+ hci_ps_cmd[4] = (index & 0xFF);
+ hci_ps_cmd[5] = ((index >> 8) & 0xFF);
+ hci_ps_cmd[6] = length;
+
+}
+
+/*
+ *Create PS download commands from parsed data
+ */
+static int ath_create_ps_command(uint8_t opcode,
+ uint32_t param_1,
+ struct ps_cmd_packet *ps_patch_packet,
+ uint32_t *index)
+{
+ uint8_t *hci_ps_cmd;
+ int i;
+
+ switch (opcode) {
+
+ case WRITE_PATCH:
+
+ for (i = 0; i < param_1; i++) {
+
+ /* Allocate command buffer */
+ hci_ps_cmd = (uint8_t *) malloc(ram_patch[i].Len +
+ HCI_CMD_HEADER_LEN);
+
+ if (!hci_ps_cmd)
+ return -ENOMEM;
+
+ /* Update commands to buffer */
+ load_hci_header(hci_ps_cmd,
+ opcode,
+ ram_patch[i].Len,
+ i);
+ memcpy(&hci_ps_cmd[HCI_CMD_HEADER_LEN],
+ ram_patch[i].Data,
+ ram_patch[i].Len);
+
+ ps_patch_packet[*index].Hcipacket = hci_ps_cmd;
+ ps_patch_packet[*index].packetLen = ram_patch[i].Len +
+ HCI_CMD_HEADER_LEN;
+
+ (*index)++;
+ }
+
+ break;
+ case ENABLE_PATCH:
+
+ hci_ps_cmd = (uint8_t *) malloc(HCI_CMD_HEADER_LEN);
+
+ if (!hci_ps_cmd)
+ return -ENOMEM;
+
+ load_hci_header(hci_ps_cmd, opcode, 0, 0x00);
+ ps_patch_packet[*index].Hcipacket = hci_ps_cmd;
+ ps_patch_packet[*index].packetLen = HCI_CMD_HEADER_LEN;
+
+ (*index)++;
+
+ break;
+ case PS_RESET:
+
+ hci_ps_cmd = (uint8_t *) malloc(PS_RESET_CMD_LEN);
+
+ if (!hci_ps_cmd)
+ return -ENOMEM;
+
+ load_hci_header(hci_ps_cmd, opcode, PS_RESET_PARAM_LEN, 0x00);
+
+ hci_ps_cmd[7] = 0x00;
+ hci_ps_cmd[PS_RESET_CMD_LEN - 2] = (param_1 & 0xFF);
+ hci_ps_cmd[PS_RESET_CMD_LEN - 1] = ((param_1 >> 8) & 0xFF);
+
+ ps_patch_packet[*index].Hcipacket = hci_ps_cmd;
+ ps_patch_packet[*index].packetLen = PS_RESET_CMD_LEN;
+
+ (*index)++;
+
+ break;
+ case PS_WRITE:
+
+ for (i = 0; i < param_1; i++) {
+
+ hci_ps_cmd =
+ (uint8_t *) malloc(ps_tag_entry[i].tag_len +
+ HCI_CMD_HEADER_LEN);
+ if (!hci_ps_cmd)
+ return -ENOMEM;
+
+ load_hci_header(hci_ps_cmd,
+ opcode,
+ ps_tag_entry[i].tag_len,
+ ps_tag_entry[i].tag_id);
+
+ memcpy(&hci_ps_cmd[HCI_CMD_HEADER_LEN],
+ ps_tag_entry[i].tag_data,
+ ps_tag_entry[i].tag_len);
+
+ ps_patch_packet[*index].Hcipacket = hci_ps_cmd;
+
+ ps_patch_packet[*index].packetLen =
+ ps_tag_entry[i].tag_len + HCI_CMD_HEADER_LEN;
+
+ (*index)++;
+ }
+
+ break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+static int get_ps_type(char *line,
+ int eol_index,
+ unsigned char *type,
+ unsigned char *sub_type)
+{
+
+ switch (eol_index) {
+ case 1:
+ return 0;
+ case 2:
+ (*type) = toupper(line[1]);
+ break;
+ case 3:
+ if (line[2] == ':')
+ (*type) = toupper(line[1]);
+ else if (line[1] == ':')
+ (*sub_type) = toupper(line[2]);
+ else
+ return -1;
+
+ break;
+ case 4:
+ if (line[2] != ':')
+ return -1;
+
+ (*type) = toupper(line[1]);
+ (*sub_type) = toupper(line[3]);
+
+ break;
+ case -1:
+ return -1;
+ }
+
+ return 0;
+}
+
+static int get_input_data_format(char *line, struct ps_data_format *pst_format)
+{
+ unsigned char type = '\0';
+ unsigned char sub_type = '\0';
+ int eol_index = -1;
+ int i;
+
+ /* The default values */
+ set_pst_format(pst_format, PS_TYPE_HEX, 1);
+
+ if (line[0] != '[') {
+ set_pst_format(pst_format, PS_TYPE_HEX, 1);
+ return 0;
+ }
+
+ for (i = 1; i < 5; i++) {
+ if (line[i] == ']') {
+ eol_index = i;
+ break;
+ }
+ }
+
+ if (get_ps_type(line, eol_index, &type, &sub_type) < 0)
+ return -1;
+
+ /* By default Hex array type is assumed */
+ if (type == '\0' && sub_type == '\0')
+ set_pst_format(pst_format, PS_TYPE_HEX, 1);
+
+ /* Check is data type is of array */
+ if (type == 'A' || sub_type == 'A')
+ pst_format->is_array = 1;
+
+ if (type == 'S' || sub_type == 'S')
+ pst_format->is_array = 0;
+
+ switch (type) {
+
+ case 'D':
+ case 'B':
+
+ pst_format->data_type = PS_TYPE_DEC;
+ break;
+ default:
+
+ pst_format->data_type = PS_TYPE_HEX;
+ break;
+
+ }
+
+ line += (eol_index + 1);
+
+ return 0;
+
+}
+
+static unsigned int read_data_in_section(char *line,
+ struct ps_data_format format_info)
+{
+ char *token_ptr = line;
+
+ if (!token_ptr)
+ return 0x0FFF;
+
+ if (token_ptr[0] == '[') {
+
+ while (token_ptr[0] != ']' && token_ptr[0] != '\0')
+ token_ptr++;
+
+ if (token_ptr[0] == '\0')
+ return 0x0FFF;
+
+ token_ptr++;
+ }
+
+ if (format_info.data_type == PS_TYPE_HEX) {
+
+ if (format_info.is_array == 1)
+ return 0x0FFF;
+ else
+ return strtol(token_ptr, NULL, 16);
+
+ } else
+ return 0x0FFF;
+
+ return 0x0FFF;
+
+}
+static int ath_parse_file(FILE *stream)
+{
+ char *buffer;
+ char *line;
+ uint8_t tag_cnt = 0;
+ int16_t byte_count = 0;
+ int read_count;
+ int num_ps_entry;
+ struct ps_data_format stps_data_format;
+ struct st_read_status read_status = { 0, 0, 0, 0 };
+
+ if (!stream) {
+ perror("Could not open config file .\n");
+ return -1;
+ }
+
+ buffer = malloc(LINE_SIZE_MAX + 1);
+
+ if (!buffer)
+ return -ENOMEM;
+
+ do {
+ line = fgets(buffer, LINE_SIZE_MAX, stream);
+
+ if (!line)
+ break;
+
+ skip_space(line);
+
+ if ((line[0] == '/') && (line[1] == '/'))
+ continue;
+
+ if ((line[0] == '#')) {
+
+ if (read_status.section != 0) {
+
+ if (buffer)
+ free(buffer);
+ return -1;
+
+ } else {
+ read_status.section = 1;
+ continue;
+ }
+ }
+
+ if ((line[0] == '/') && (line[1] == '*')) {
+
+ read_status.section = 0;
+ continue;
+ }
+
+ if (read_status.section == 1) {
+ skip_space(line);
+
+ if (get_input_data_format(
+ line, &stps_data_format) < 0) {
+
+ if (buffer)
+ free(buffer);
+ return -1;
+
+ }
+
+ ps_tag_entry[tag_cnt].tag_id = read_data_in_section(
+ line,
+ stps_data_format);
+ read_status.section = 2;
+
+ } else if (read_status.section == 2) {
+
+ if (get_input_data_format(
+ line, &stps_data_format) < 0) {
+
+ if (buffer)
+ free(buffer);
+ return -1;
+ }
+
+ byte_count =
+ read_data_in_section(line, stps_data_format);
+
+ read_status.section = 2;
+ if (byte_count > LINE_SIZE_MAX / 2) {
+ if (buffer)
+ free(buffer);
+
+ return -1;
+ }
+
+ ps_tag_entry[tag_cnt].tag_len = byte_count;
+ ps_tag_entry[tag_cnt].tag_data = (uint8_t *)
+ malloc(byte_count);
+
+ read_status.section = 3;
+ read_status.line_count = 0;
+
+ } else if (read_status.section == 3) {
+
+ if (read_status.line_count == 0) {
+ if (get_input_data_format(
+ line, &stps_data_format) < 0) {
+ if (buffer)
+ free(buffer);
+ return -1;
+ }
+ }
+
+ skip_space(line);
+ read_status.char_cnt = 0;
+
+ if (line[read_status.char_cnt] == '[') {
+
+ while (line[read_status.char_cnt] != ']' &&
+ line[read_status.char_cnt] != '\0')
+ read_status.char_cnt++;
+
+ if (line[read_status.char_cnt] == ']')
+ read_status.char_cnt++;
+ else
+ read_status.char_cnt = 0;
+
+ }
+
+ read_count = (byte_count > BYTES_OF_PS_DATA_PER_LINE)
+ ? BYTES_OF_PS_DATA_PER_LINE : byte_count;
+
+ if (stps_data_format.data_type == PS_TYPE_HEX &&
+ stps_data_format.is_array == 1) {
+
+ while (read_count > 0) {
+
+ ps_tag_entry[tag_cnt].tag_data
+ [read_status.byte_count] =
+ stringtohex(
+ &line[read_status.char_cnt]);
+
+ ps_tag_entry[tag_cnt].tag_data
+ [read_status.byte_count + 1] =
+ stringtohex(
+ &line[read_status.char_cnt + 3]);
+
+ read_status.char_cnt += 6;
+ read_status.byte_count += 2;
+ read_count -= 2;
+
+ }
+
+ if (byte_count > BYTES_OF_PS_DATA_PER_LINE)
+ byte_count -=
+ BYTES_OF_PS_DATA_PER_LINE;
+ else
+ byte_count = 0;
+ }
+
+ read_status.line_count++;
+
+ if (byte_count == 0) {
+ read_status.section = 0;
+ read_status.char_cnt = 0;
+ read_status.line_count = 0;
+ read_status.byte_count = 0;
+ } else
+ read_status.char_cnt = 0;
+
+ if (read_status.section == 0) {
+ tag_cnt++;
+
+ if (tag_cnt == RAMPS_MAX_PS_TAGS_PER_FILE) {
+ if (buffer)
+ free(buffer);
+ return -1;
+ }
+ }
+
+ }
+
+ } while (line);
+
+ num_ps_entry = tag_cnt;
+
+ if (tag_cnt > RAMPS_MAX_PS_TAGS_PER_FILE) {
+ if (buffer)
+ free(buffer);
+ return -1;
+ }
+
+ if (buffer)
+ free(buffer);
+
+ return num_ps_entry;
+}
+
+static int parse_patch_file(FILE *stream)
+{
+ char byte[3];
+ char line[MAX_BYTE_LENGTH + 1];
+ int byte_cnt, byte_cnt_org;
+ int patch_index;
+ int i, k;
+ int data;
+ int patch_count = 0;
+
+ byte[2] = '\0';
+
+ while (fgets(line, MAX_BYTE_LENGTH, stream)) {
+ if (strlen(line) <= 1 || !isxdigit(line[0]))
+ continue;
+ else
+ break;
+ }
+
+ byte_cnt = strtol(line, NULL, 16);
+ byte_cnt_org = byte_cnt;
+
+ while (byte_cnt > MAX_BYTE_LENGTH) {
+
+ /* Handle case when the number of patch buffer is
+ * more than the 20K */
+ if (MAX_NUM_PATCH_ENTRY == patch_count) {
+ for (i = 0; i < patch_count; i++)
+ free(ram_patch[i].Data);
+ return -ENOMEM;
+ }
+
+ ram_patch[patch_count].Len = MAX_BYTE_LENGTH;
+ ram_patch[patch_count].Data =
+ (uint8_t *) malloc(MAX_BYTE_LENGTH);
+
+ if (!ram_patch[patch_count].Data)
+ return -ENOMEM;
+
+ patch_count++;
+ byte_cnt = byte_cnt - MAX_BYTE_LENGTH;
+ }
+
+ ram_patch[patch_count].Len = (byte_cnt & 0xFF);
+
+ if (byte_cnt != 0) {
+ ram_patch[patch_count].Data = (uint8_t *) malloc(byte_cnt);
+
+ if (!ram_patch[patch_count].Data)
+ return -ENOMEM;
+ patch_count++;
+ }
+
+ while (byte_cnt_org > MAX_BYTE_LENGTH) {
+
+ k = 0;
+ for (i = 0; i < MAX_BYTE_LENGTH * 2; i += 2) {
+ if (!fgets(byte, 3, stream))
+ return -1;
+ data = strtoul(&byte[0], NULL, 16);
+ ram_patch[patch_index].Data[k] = (data & 0xFF);
+
+ k++;
+ }
+
+ patch_index++;
+
+ byte_cnt_org = byte_cnt_org - MAX_BYTE_LENGTH;
+ }
+
+ if (patch_index == 0)
+ patch_index++;
+
+ for (k = 0; k < byte_cnt_org; k++) {
+
+ if (!fgets(byte, 3, stream))
+ return -1;
+
+ data = strtoul(byte, NULL, 16);
+ ram_patch[patch_index].Data[k] = (data & 0xFF);
+ }
+
+ return patch_count;
+}
+
+static int ath_parse_ps(FILE *stream, int *total_tag_len)
+{
+ int num_ps_tags;
+ int i;
+ unsigned char bdaddr_present = 0;
+
+ if (stream)
+ num_ps_tags = ath_parse_file(stream);
+
+ if (num_ps_tags < 0)
+ return -1;
+
+ if (num_ps_tags == 0)
+ *total_tag_len = 10;
+ else {
+
+ for (i = 0; i < num_ps_tags; i++) {
+
+ if (ps_tag_entry[i].tag_id == 1)
+ bdaddr_present = 1;
+ if (ps_tag_entry[i].tag_len % 2 == 1)
+ *total_tag_len = *total_tag_len
+ + ps_tag_entry[i].tag_len + 1;
+ else
+ *total_tag_len =
+ *total_tag_len + ps_tag_entry[i].tag_len;
+
+ }
+ }
+
+ if (num_ps_tags > 0 && !bdaddr_present)
+ *total_tag_len = *total_tag_len + 10;
+
+ *total_tag_len = *total_tag_len + 10 + (num_ps_tags * 4);
+
+ return num_ps_tags;
+}
+
+static int ath_create_cmd_list(struct ps_cmd_packet **hci_packet_list,
+ uint32_t *num_packets,
+ int tag_count,
+ int patch_count,
+ int total_tag_len)
+{
+ uint8_t count;
+ uint32_t num_cmd_entry = 0;
+
+ *num_packets = 0;
+
+ if (patch_count || tag_count) {
+
+ /* PS Reset Packet + Patch List + PS List */
+ num_cmd_entry += (1 + patch_count + tag_count);
+ if (patch_count > 0)
+ num_cmd_entry++; /* Patch Enable Command */
+
+ (*hci_packet_list) =
+ malloc(sizeof(struct ps_cmd_packet) * num_cmd_entry);
+
+ if (!(*hci_packet_list))
+ return -ENOMEM;
+
+ if (patch_count > 0) {
+
+ if (ath_create_ps_command(WRITE_PATCH, patch_count,
+ *hci_packet_list, num_packets) < 0)
+ return -1;
+ if (ath_create_ps_command(ENABLE_PATCH, 0,
+ *hci_packet_list, num_packets) < 0)
+ return -1;
+ if (ath_create_ps_command(PS_RESET,
+ total_tag_len + EXTRA_PATCH_SIZE,
+ *hci_packet_list, num_packets) < 0)
+ return -1;
+
+ } else {
+
+ if (ath_create_ps_command(PS_RESET, total_tag_len,
+ *hci_packet_list, num_packets) < 0)
+ return -1;
+ }
+
+ if (tag_count > 0)
+ ath_create_ps_command(PS_WRITE, tag_count,
+ *hci_packet_list, num_packets);
+ }
+
+ for (count = 0; count < patch_count; count++)
+ free(ram_patch[patch_count].Data);
+
+ for (count = 0; count < tag_count; count++)
+ free(ps_tag_entry[count].tag_data);
+
+ return *num_packets;
+}
+
+static int ath_free_command_list(struct ps_cmd_packet **hci_packet_list,
+ uint32_t num_packets)
+{
+ int i;
+
+ if (!(*hci_packet_list))
+ return -1;
+
+ for (i = 0; i < num_packets; i++)
+ free((*hci_packet_list)[i].Hcipacket);
+
+ free(*hci_packet_list);
+
+ return 0;
+}
+
+/*
+ * This API is used to send the HCI command to controller and return
+ * with a HCI Command Complete event.
+ */
+static int send_hci_cmd_wait_event(int dev,
+ uint8_t *hci_command,
+ int cmd_length,
+ uint8_t **event, uint8_t **buffer_to_free)
+{
+ int r;
+ uint8_t *hci_event;
+ uint8_t pkt_type = 0x01;
+
+ if (cmd_length == 0)
+ return -1;
+
+ if (write(dev, &pkt_type, 1) != 1)
+ return -1;
+
+ if (write(dev, (unsigned char *)hci_command, cmd_length) != cmd_length)
+ return -1;
+
+ hci_event = (uint8_t *) malloc(100);
+
+ if (!hci_event)
+ return -ENOMEM;
+
+ r = read_hci_event(dev, (unsigned char *)hci_event, 100);
+
+ if (r > 0) {
+ *event = hci_event;
+ *buffer_to_free = hci_event;
+ } else {
+
+ /* Did not get an event from controller. return error */
+ free(hci_event);
+ *buffer_to_free = NULL;
+ return -1;
+ }
+
+ return 0;
+}
+
+static int read_ps_event(uint8_t *data)
+{
+
+ if (data[5] == 0xFC && data[6] == 0x00) {
+
+ switch (data[4]) {
+
+ case 0x0B:/* CRC Check */
+ case 0x0C:/* Change Baudrate */
+ case 0x04:/* Enable sleep */
+ return 0;
+ break;
+ default:
+ return -1;
+ break;
+
+ }
+ }
+
+ return -1;
+}
+
+static int get_ps_file_name(int devtype, int rom_version, char *path)
+{
+ char *filename;
+ int status = 0;
+
+ if (devtype == 0xdeadc0de) {
+ filename = PS_ASIC_FILE;
+ status = 1;
+ } else {
+ filename = PS_FPGA_FILE;
+ status = 0;
+ }
+
+ sprintf(path, "%s%x/%s", FW_PATH, rom_version, filename);
+
+ return status;
+}
+
+static int get_patch_file_name(int dev_type, int rom_version,
+ int build_version, char *path)
+{
+
+ if ((dev_type != 0) &&
+ (dev_type != 0xdeadc0de) &&
+ (rom_version == 0x99999999) &&
+ (build_version == 1))
+ path[0] = '\0';
+ else
+ sprintf(path, "%s%x/%s", FW_PATH, rom_version, PATCH_FILE);
+
+ return 0;
+}
+static int get_ar3k_crc(int dev, int tag_count, int patch_count)
+{
+ uint8_t hci_cmd[7];
+ uint8_t *event;
+ uint8_t *buffer_to_free = NULL;
+ int retval = 1;
+ int crc;
+
+ if (patch_count > 0)
+ crc |= RAM_PATCH_REGION;
+ if (tag_count > 0)
+ crc |= RAM_PS_REGION;
+
+ load_hci_header(hci_cmd, PS_VERIFY_CRC, 0, crc);
+
+ if (send_hci_cmd_wait_event(dev,
+ hci_cmd,
+ sizeof(hci_cmd),
+ &event,
+ &buffer_to_free) == 0) {
+
+ if (read_ps_event(event) == 0)
+ retval = -1;
+
+ if (buffer_to_free != NULL)
+ free(buffer_to_free);
+ }
+
+ return retval;
+}
+static int get_device_type(int dev, uint32_t *code)
+{
+ uint8_t hci_cmd[] = { 0x05, 0xfc, 0x05, 0x00, 0x00, 0x00, 0x00, 0x04 };
+ uint8_t *event;
+ uint8_t *buffer_to_free = NULL;
+ uint32_t reg;
+ int result = -1;
+
+ *code = 0;
+
+ hci_cmd[3] = (uint8_t) (DEV_REGISTER & 0xFF);
+ hci_cmd[4] = (uint8_t) ((DEV_REGISTER >> 8) & 0xFF);
+ hci_cmd[5] = (uint8_t) ((DEV_REGISTER >> 16) & 0xFF);
+ hci_cmd[6] = (uint8_t) ((DEV_REGISTER >> 24) & 0xFF);
+
+ if (send_hci_cmd_wait_event(dev,
+ hci_cmd,
+ sizeof(hci_cmd),
+ &event,
+ &buffer_to_free) == 0) {
+
+ if (event[5] == 0xFC && event[6] == 0x00) {
+
+ switch (event[4]) {
+ case 0x05:
+ reg = event[10];
+ reg = ((reg << 8) | event[9]);
+ reg = ((reg << 8) | event[8]);
+ reg = ((reg << 8) | event[7]);
+ *code = reg;
+ result = 0;
+
+ break;
+
+ case 0x06:
+ break;
+ }
+ }
+ }
+
+ if (buffer_to_free)
+ free(buffer_to_free);
+
+ return result;
+}
+
+static int read_ar3k_version(int pConfig, int *rom_version, int *build_version)
+{
+ uint8_t hci_cmd[] = { 0x1E, 0xfc, 0x00 };
+ uint8_t *event;
+ uint8_t *buffer_to_free = NULL;
+ int result = -1;
+
+ if (send_hci_cmd_wait_event(pConfig,
+ hci_cmd,
+ sizeof(hci_cmd),
+ &event,
+ &buffer_to_free) == 0) {
+
+ if (event[5] == 0xFC &&
+ event[6] == 0x00 &&
+ event[4] == 0x1E) {
+
+ (*rom_version) = event[10];
+ (*rom_version) = (((*rom_version) << 8) | event[9]);
+ (*rom_version) = (((*rom_version) << 8) | event[8]);
+ (*rom_version) = (((*rom_version) << 8) | event[7]);
+
+ (*build_version) = event[14];
+ (*build_version) = (((*build_version) << 8) |
+ event[13]);
+ (*build_version) = (((*build_version) << 8) |
+ event[12]);
+ (*build_version) = (((*build_version) << 8) |
+ event[11]);
+
+ result = 1;
+
+ }
+
+ if (buffer_to_free)
+ free(buffer_to_free);
+ }
+
+ return result;
+}
+
+static int str2bdaddr(char *str_bdaddr, char *bdaddr)
+{
+ char bdbyte[3];
+ char *str_byte = str_bdaddr;
+ int i, j;
+ unsigned char colon_present = 0;
+
+ if (strstr(str_bdaddr, ":"))
+ colon_present = 1;
+
+ bdbyte[2] = '\0';
+
+ for (i = 0, j = 5; i < 6; i++, j--) {
+
+ bdbyte[0] = str_byte[0];
+ bdbyte[1] = str_byte[1];
+ bdaddr[j] = strtol(bdbyte, NULL, 16);
+
+ if (colon_present == 1)
+ str_byte += 3;
+ else
+ str_byte += 2;
+ }
+ return 0;
+}
+
+static int write_bdaddr(int pConfig, char *bdaddr)
+{
+ uint8_t bdaddr_cmd[] = { 0x0B, 0xFC, 0x0A,
+ 0x01, 0x01, 0x00,
+ 0x06, 0x00, 0x00,
+ 0x00, 0x00, 0x00,
+ 0x00 };
+ uint8_t *event;
+ uint8_t *buffer_to_free = NULL;
+ int result = -1;
+
+ str2bdaddr(bdaddr, (char *)&bdaddr_cmd[7]);
+
+ if (send_hci_cmd_wait_event(pConfig,
+ bdaddr_cmd,
+ sizeof(bdaddr_cmd),
+ &event,
+ &buffer_to_free) == 0) {
+
+ if (event[5] == 0xFC && event[6] == 0x00) {
+ if (event[4] == 0x0B)
+ result = 0;
+ }
+
+ }
+
+ if (buffer_to_free)
+ free(buffer_to_free);
+
+ return result;
+}
+
+int ath_configure_sleep(int fd, int sleep_stat)
+{
+ int dev_id, dd;
+ struct timespec tm = {0, 50000};
+
+ dev_id = ioctl(fd, HCIUARTGETDEVICE, 0);
+
+ if (dev_id < 0) {
+ perror("cannot get device id");
+ return -1;
+ }
+
+ dd = hci_open_dev(dev_id);
+
+ if (dd < 0) {
+ perror("HCI device open failed");
+ return -1;
+ }
+
+ sleep(2);
+
+ /* send vendor specific command with Sleep feature Enabled */
+ if (hci_send_cmd(dd, OGF_VENDOR_CMD, 0x04, 1, &sleep_stat) < 0)
+ perror("Power management Disabled");
+
+ nanosleep(&tm, NULL);
+ hci_close_dev(dd);
+
+ return 0;
+}
+
+int ath_ps_download(int hdev)
+{
+ int i;
+ int status = 0;
+ int tag_count;
+ int patch_count;
+ int total_tag_len = 0;
+ int rom_version = 0, build_version = 0;
+
+ struct ps_cmd_packet *hci_cmd_list; /* List storing the commands */
+ uint32_t num_cmds;
+ uint8_t *event;
+ uint8_t *buffer_to_free;
+ uint32_t dev_type;
+
+ char patch_file[PATH_MAX];
+ char ps_file[PATH_MAX];
+ char bdaddr_file[PATH_MAX];
+
+ FILE *stream;
+ char bdaddr[21];
+
+ hci_cmd_list = NULL;
+
+ /*
+ * Verfiy firmware version. depending on it select the PS
+ * config file to download.
+ */
+ if (get_device_type(hdev, &dev_type) == -1) {
+ status = -1;
+ goto download_cmplete;
+ }
+ if (read_ar3k_version(hdev, &rom_version, &build_version) == -1) {
+ status = -1;
+ goto download_cmplete;
+ }
+
+ get_ps_file_name(dev_type, rom_version, ps_file);
+
+ get_patch_file_name(dev_type, rom_version, build_version, patch_file);
+
+ /* Read the PS file to a dynamically allocated buffer */
+ stream = fopen(ps_file, "r");
+
+ if (!stream) {
+ perror("firmware file open error\n");
+ status = -1;
+ goto download_cmplete;
+ }
+
+ tag_count = ath_parse_ps(stream, &total_tag_len);
+
+ fclose(stream);
+
+ if (tag_count == -1) {
+ status = -1;
+ goto download_cmplete;
+ }
+
+ /*
+ * It is not necessary that Patch file be available,
+ * continue with PS Operations if.
+ * failed.
+ */
+ if (patch_file[0] == '\0')
+ status = 0;
+
+ stream = fopen(patch_file, "r");
+
+ if (!stream) {
+ patch_count = 0;
+ status = 0;
+ } else {
+ /* parse and store the Patch file contents to
+ * a global variables
+ */
+ patch_count = parse_patch_file(stream);
+
+ fclose(stream);
+
+ if (patch_count < 0) {
+ status = -1;
+ goto download_cmplete;
+ }
+ }
+
+ /*
+ * Send the CRC packet,
+ * Continue with the PS operations
+ * only if the CRC check failed
+ */
+ if (get_ar3k_crc(hdev, tag_count, patch_count) < 0) {
+ status = 0;
+ goto download_cmplete;
+ }
+
+ /* Create an HCI command list
+ * from the parsed PS and patch information
+ */
+ ath_create_cmd_list(&hci_cmd_list,
+ &num_cmds,
+ tag_count,
+ patch_count,
+ total_tag_len);
+
+ for (i = 0; i < num_cmds; i++) {
+
+ if (send_hci_cmd_wait_event
+ (hdev,
+ hci_cmd_list[i].Hcipacket,
+ hci_cmd_list[i].packetLen,
+ &event,
+ &buffer_to_free) == 0) {
+
+ if (read_ps_event(event) < 0) {
+
+ /* Exit if the status is not success */
+ if (buffer_to_free)
+ free(buffer_to_free);
+
+ status = -1;
+ goto download_cmplete;
+ }
+ if (buffer_to_free)
+ free(buffer_to_free);
+ } else {
+ status = 0;
+ goto download_cmplete;
+ }
+ }
+ /* Read the PS file to a dynamically allocated buffer */
+ sprintf(bdaddr_file, "%s%x/%s", FW_PATH, rom_version, BDADDR_FILE);
+
+ stream = fopen(bdaddr_file, "r");
+
+ if (!stream) {
+ status = 0;
+ goto download_cmplete;
+ }
+
+ if (fgets(bdaddr, 20, stream))
+ status = write_bdaddr(hdev, bdaddr);
+
+ fclose(stream);
+
+download_cmplete:
+
+ if (hci_cmd_list)
+ ath_free_command_list(&hci_cmd_list, num_cmds);
+
+ return status;
+}
--
1.7.0
^ permalink raw reply related
* Re: [PATCH] HID:magicmouse: This fixes a connection problem with the magicmouse.
From: Jiri Kosina @ 2010-05-12 13:41 UTC (permalink / raw)
To: Justin P. Mattock; +Cc: linux-bluetooth, linux-kernel, mdpoole
In-Reply-To: <4BEAAF9C.909@gmail.com>
On Wed, 12 May 2010, Justin P. Mattock wrote:
> > > --- a/drivers/hid/hid-magicmouse.c
> > > +++ b/drivers/hid/hid-magicmouse.c
> > > @@ -354,7 +354,7 @@ static int magicmouse_probe(struct hid_device *hdev,
> > > goto err_free;
> > > }
> > >
> > > - ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT& ~HID_CONNECT_HIDINPUT);
> > > + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
> > >
> > This is not particularly right, as we'll end up having dangling input
> > device.
> >
> > The problem is, that when HIDRAW is not set, hid_hw_start() returns ENODEV
> > as no subsystem has claimed the device, and probe routine bails out. Which
> > is not what we want.
> >
> > Does the testing patch below fix the problems you are seeing?
> >
> >
> >
> works good.. rebooted a few times mouse connects. suspended a few times
> mouse reconnects.
I'd be glad if you could also double-check that device removal and
re-connecting it works well as well with this patch.
> > diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
> > index 0d471fc..f10d56a 100644
> > --- a/drivers/hid/hid-magicmouse.c
> > +++ b/drivers/hid/hid-magicmouse.c
> > @@ -354,12 +354,15 @@ static int magicmouse_probe(struct hid_device *hdev,
> > goto err_free;
> > }
> >
> > - ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT& ~HID_CONNECT_HIDINPUT);
> > + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
> > if (ret) {
> > dev_err(&hdev->dev, "magicmouse hw start failed\n");
> > goto err_free;
> > }
> >
> > + /* we are handling the input ourselves */
> > + hidinput_disconnect(hdev);
> > +
> > report = hid_register_report(hdev, HID_INPUT_REPORT, TOUCH_REPORT_ID);
> > if (!report) {
> > dev_err(&hdev->dev, "unable to register touch report\n");
> >
> >
>
> looks good over here.. If you'd like I can re-du this patch, add your
> sign off etc.. and re-send, or not worry.. either way this little
> quirk/problem is fixed.
No problem, once you confirm that device removal wasn't broken again and
if I don't hear any objections from Michael, I will queue the patch
myself.
Thanks,
--
Jiri Kosina
SUSE Labs, Novell Inc.
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox