Return-Path: MIME-Version: 1.0 In-Reply-To: <000101cfc66e$00719660$0154c320$@samsung.com> References: <000001cfb169$e4d01bc0$ae705340$@samsung.com> <002101cfb550$afb1f400$0f15dc00$@samsung.com> <006d01cfc5e0$6b4df110$41e9d330$@samsung.com> <000101cfc66e$00719660$0154c320$@samsung.com> Date: Tue, 2 Sep 2014 11:28:38 +0300 Message-ID: Subject: Re: Query regarding MAP 1.2 implementation From: Luiz Augusto von Dentz To: Gowtham Anandha Babu Cc: "linux-bluetooth@vger.kernel.org" Content-Type: multipart/mixed; boundary=089e013cba22fb6946050210e7fa Sender: linux-bluetooth-owner@vger.kernel.org List-ID: --089e013cba22fb6946050210e7fa Content-Type: text/plain; charset=UTF-8 Hi, On Tue, Sep 2, 2014 at 8:22 AM, Gowtham Anandha Babu wrote: > > Hi Luiz, > >> -----Original Message----- >> From: linux-bluetooth-owner@vger.kernel.org [mailto:linux-bluetooth- >> owner@vger.kernel.org] On Behalf Of Luiz Augusto von Dentz >> Sent: Monday, September 01, 2014 6:37 PM >> To: Gowtham Anandha Babu >> Cc: linux-bluetooth@vger.kernel.org; Bharat Panda >> Subject: Re: Query regarding MAP 1.2 implementation >> >> Hi, >> >> On Mon, Sep 1, 2014 at 3:29 PM, Gowtham Anandha Babu >> wrote: >> >> > The current message-dummy.c looks like, it is creating a virtual folder in the >> system (Ex. Home/PC-NAME/map-messages/). >> > So, I created the map-messages directory in home/PC-NAME/. Then I tried >> SETPATH (mentioned in the previous thread). >> > The output is... >> > >> > obexd[29146]: obexd/src/obex.c:cmd_setpath() >> > obexd[29146]: SETPATH(0x5), (null)(0xffffffff) >> > obexd[29146]: obexd/src/obex.c:parse_name() NAME: >> > obexd[29146]: obexd/plugins/mas.c:mas_setpath() SETPATH: name >> nonhdr >> > 0x20 >> > obexd[29146]: SETPATH(0x5), SUCCESS(0x20) >> > >> > But When I tried to call GetFolderListing() The output is... >> > >> > obexd[29146]: obexd/src/obex.c:cmd_get() session 0x1008c40 >> > obexd[29146]: GET(0x3), (null)(0xffffffff) >> > obexd[29146]: obexd/src/obex.c:parse_type() TYPE: >> > x-obex/folder-listing >> > obexd[29146]: obexd/plugins/mas.c:mas_get() GET: name (null) type >> > x-obex/folder-listing mas 0x1015c00 >> > obexd[29146]: obexd/plugins/mas.c:get_params() Error when parsing >> parameters! >> > obexd[29146]: GET(0x3), BAD_REQUEST(0x40) >> > >> > But I had few folders created inside the map-messages. >> >> Bad request is normally when there is something wrong with the command >> itself, the error comes from here: >> >> mas->inparams = g_obex_apparam_decode(buffer, size); >> if (mas->inparams == NULL) { >> DBG("Error when parsing parameters!"); >> return -EBADR; >> } >> >> I suspect the problem is that there is no application parameters set which is >> fine since all the parameters of GetFolderListing are optional, please try with >> the attached patch I will send it shortly as a proper patch to the mailing list. >> >> >> -- >> Luiz Augusto von Dentz > > > I applied the patch which was attached in the previous reply. Still I am getting the same error. > I tried printing the "size" inside the get_params function. Its value is '0' for GetFolderListing request. > If size=0, then g_obex_apparam_decode() function always return NULL, which leads to "Error when parsing parameters!". My bad, the check should be size <= 0 otherwise it will still cause this problem. -- Luiz Augusto von Dentz --089e013cba22fb6946050210e7fa Content-Type: text/x-patch; charset=US-ASCII; name="0001-obexd-mas-Fix-parsing-of-application-parameters.patch" Content-Disposition: attachment; filename="0001-obexd-mas-Fix-parsing-of-application-parameters.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hzkz4wx90 RnJvbSBlOTBkYWJhOWEyMDJmMDcyZDYyNmYzNDA0YzdiMDE4MWE0YWEzYWMxIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBMdWl6IEF1Z3VzdG8gdm9uIERlbnR6IDxsdWl6LnZvbi5kZW50 ekBpbnRlbC5jb20+CkRhdGU6IE1vbiwgMSBTZXAgMjAxNCAxNjowMTo0MCArMDMwMApTdWJqZWN0 OiBbUEFUQ0ggQmx1ZVpdIG9iZXhkL21hczogRml4IHBhcnNpbmcgb2YgYXBwbGljYXRpb24gcGFy YW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