Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp2065974pxb; Fri, 25 Mar 2022 10:28:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBoav1xIix2kqNUDZSfikWE1F2cMOmsb1M1vr2Z2VLCAedISTnfb6Fs2KHNajXuou+76j1 X-Received: by 2002:a62:e213:0:b0:4fa:6b13:3a9a with SMTP id a19-20020a62e213000000b004fa6b133a9amr11244724pfi.18.1648229334418; Fri, 25 Mar 2022 10:28:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648229334; cv=none; d=google.com; s=arc-20160816; b=ZQBVPJw0ZX0omszNlmk8RxzQBNiBGUyqQAy4RuDrySWtB4i9oz+p3Dzj7bv/VG6BaB 18QPkNmRsyu6kJwwVpEXwPQ2qEcYuwWttLemkpCZX5z2KoENCVp/tHijw6prXpYpnMMa 6EdrBeqj0O/eV2dySSXTpeApkdnHhQiDIyU/t1kAIt1MZbgOOBSvWLwdx9LpLaWa3+zd aftOHPsJw1scSyuizYjc7EoLfjc7eqCGTsApDTMPlqzB0o1ZyX7718aVa24mEEw1WDRn v3UddYkhVglzUj89LaRkniB7xjAPRmmp6FBAPXah0uHAnaaK8FbspCzV+gnLc6ooeGvm c+lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from:cc :references:to:content-language:subject:user-agent:mime-version:date :message-id; bh=lcy1WQVEDPwfddgwlHU5O/vQO8o7QbAY+LBbB8k0Fdo=; b=anhCLuzMJlBRVIgqVfuSDFWFIaBfKu5XQJpV5mC76Oeh8ydhrxdmfO98LLkgmu433j WXXAa13FwhnZgGiv9CFGow8hO3UWf6OciGv3aiqlHPXPMw/9MTiXMVopM8cC1qADMJSi C9MKeHPFC4REgwH5+uMwsaFvdegRsZ07tavy2a+rNOyEuMpYkJjkFepuA4riAafkZMEk 4uq3PdmsqKlbOtoL2XPt/aHYYkWOmqnBOM9Dupr5pHl76JaYKDmKcMMO+jUuC8vyWFu4 Fea4CYSINAjA3YHQqVF1Xkh5cmxF0SfNmfJxCqmJtzwYw7DAuDoIdd6qnsn16ZZXElFv 1QyA== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-bluetooth-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h192-20020a6283c9000000b004fa4d7f0c04si2944455pfe.208.2022.03.25.10.28.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Mar 2022 10:28:54 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-bluetooth-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-bluetooth-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 19BF41042BC; Fri, 25 Mar 2022 10:22:17 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346412AbiCYHfX (ORCPT + 99 others); Fri, 25 Mar 2022 03:35:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353698AbiCYHfW (ORCPT ); Fri, 25 Mar 2022 03:35:22 -0400 Received: from mx1.molgen.mpg.de (mx3.molgen.mpg.de [141.14.17.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08F984DF75 for ; Fri, 25 Mar 2022 00:33:47 -0700 (PDT) Received: from [192.168.0.3] (ip5f5aef76.dynamic.kabel-deutschland.de [95.90.239.118]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pmenzel) by mx.molgen.mpg.de (Postfix) with ESMTPSA id 8BB4D61E64846; Fri, 25 Mar 2022 08:33:46 +0100 (CET) Message-ID: Date: Fri, 25 Mar 2022 08:33:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v2] obexd: Fix can't receive small files sent by windows Content-Language: en-US To: Xinpeng Wang References: <20220325071350.26668-1-wangxinpeng@uniontech.com> Cc: linux-bluetooth@vger.kernel.org From: Paul Menzel In-Reply-To: <20220325071350.26668-1-wangxinpeng@uniontech.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Dear Xinpeng, Am 25.03.22 um 08:13 schrieb xinpeng wang: > When obexd receives a file, it parses the filename and other parameters > when processing the packet for the first time, store filename in > obex_session and emit the dbus signal, The signal will be pending first. > then when this file is received, transfer_complete reset obex_session > is called. > > When using a computer with Windows 10 installed to send a file to bluez, > obexd will read the data through read_stream; if it is a small file, the > data processed for the first time is marked as final, and transfer_complete > reset obex_session will be called when the data is processed for the first > time. At this point, the dbus signal is still pending, and the dbus method > that requests the file path has not been processed. This will cause the upper > application to not be able to transfer files from the cache directory to the > directory specified by the user. > > To solve this problem, emit Filename's dbus signal and force it when > status=active. > > Ways to reproduce the problem: > 1. Use the computer with windows 10 installed to send a small file to the > computer with ubuntu installed; > 2. file size < 10k; > 3. After sending, in most cases, the file is located in the ~/.cache/obexd/ > directory. Normally, the file should be located in the ~/Download directory. > > To fix this, after applying this commit, it also needs to be modified by > the upper-level application. Modified to read Filename from dbus signal if > there is Filename in dbus signal. Otherwise, use the dbus method to request > Filename. > > Signed-off-by: xinpeng wang > --- > v2: Add the steps to reproduce the bug in the submission information. > > obexd/src/manager.c | 6 +++++- > obexd/src/obex.c | 1 + > 2 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/obexd/src/manager.c b/obexd/src/manager.c > index 01741fe62..2c180dc44 100644 > --- a/obexd/src/manager.c > +++ b/obexd/src/manager.c > @@ -533,8 +533,12 @@ void manager_emit_transfer_property(struct obex_transfer *transfer, > void manager_emit_transfer_started(struct obex_transfer *transfer) > { > transfer->status = TRANSFER_STATUS_ACTIVE; > + if (!transfer->path) > + return; > > - manager_emit_transfer_property(transfer, "Status"); > + g_dbus_emit_property_changed_full(connection, transfer->path, > + TRANSFER_INTERFACE, "Status", > + G_DBUS_PROPERTY_CHANGED_FLAG_FLUSH); > } > > static void emit_transfer_completed(struct obex_transfer *transfer, > diff --git a/obexd/src/obex.c b/obexd/src/obex.c > index 3a68fd66c..c0d9e160a 100644 > --- a/obexd/src/obex.c > +++ b/obexd/src/obex.c > @@ -720,6 +720,7 @@ int obex_put_stream_start(struct obex_session *os, const char *filename) > manager_emit_transfer_property(os->service_data, "Size"); > > os->path = g_strdup(filename); > + manager_emit_transfer_property(os->service_data, "Filename"); > > return 0; > } Awesome. Thank you. Acked-by: Paul Menzel Kind regards, Paul