New issue
Advanced search Search tips

Issue 598287 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 28
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

mtpd: log spew when non-MTP USB device is attached

Project Member Reported by djkurtz@chromium.org, Mar 28 2016

Issue description

Chrome OS Version: 8120.0.0
Chrome OS Platform: any

Steps To Reproduce:
(1) plug gnubby into USB
(2) inspect /var/log/messages
(3)

Expected Result:

No debug spew from mtpd

Actual Result:

2016-03-28T18:20:25.353331+08:00 ERR mtpd[2423]: LIBMTP_Detect_Raw_Devices failed with 5


How frequently does this problem reproduce? (Always, sometimes, hard to
reproduce?)

Always.

What is the impact to the user, and is there a workaround? If so, what is
it?

Excessive log spam increases cognitive load.

Please provide any additional information below. Attach a screen shot or
log if possible.

A brief peek at mtpd [0] and libmtp [1] shows that LIBMTP_Detect_Raw_Devices() can propagate LIBMTP_ERROR_NO_DEVICE_ATTACHED from get_mtp_usb_device_list() (if there is no MTP device attached?):

[0] https://chromium.googlesource.com/chromiumos/platform/mtpd/+/master/device_manager.cc
[1] http://libmtp.sourcearchive.com/documentation/0.3.4/group__basic_ge54131d2a1ed21292fa270921afb9d46.html

It is probably not necessary to spam the log in this case during DeviceManager::AddOrUpdateDevices() [0]:
[2] https://chromium.googlesource.com/chromiumos/platform/mtpd/+/master/device_manager.cc#649

0e5015f2 (Lei Zhang      2012-08-06 17:05:33 -0700 652)   LIBMTP_error_number_t err =
0e5015f2 (Lei Zhang      2012-08-06 17:05:33 -0700 653)       LIBMTP_Detect_Raw_Devices(&raw_devices, &raw_devices_count);
0e5015f2 (Lei Zhang      2012-08-06 17:05:33 -0700 654)   if (err != LIBMTP_ERROR_NONE) {
0e5015f2 (Lei Zhang      2012-08-06 17:05:33 -0700 655)     LOG(ERROR) << "LIBMTP_Detect_Raw_Devices failed with " << err;
5e6caea5 (Kevin Bailey   2013-11-14 07:04:57 -0800 656)     return NULL;
0e5015f2 (Lei Zhang      2012-08-06 17:05:33 -0700 657)   }


A similar check already exists in DeviceManager::RemoveDevices() [3]:
[3] https://chromium.googlesource.com/chromiumos/platform/mtpd/+/master/device_manager.cc#649

0e5015f2 (Lei Zhang      2012-08-06 17:05:33 -0700 773)   if (!remove_all) {
0e5015f2 (Lei Zhang      2012-08-06 17:05:33 -0700 774)     LIBMTP_error_number_t err =
0e5015f2 (Lei Zhang      2012-08-06 17:05:33 -0700 775)         LIBMTP_Detect_Raw_Devices(&raw_devices, &raw_devices_count);
0e5015f2 (Lei Zhang      2012-08-06 17:05:33 -0700 776)     if (!(err == LIBMTP_ERROR_NONE || err == LIBMTP_ERROR_NO_DEVICE_ATTACHED)) {
0e5015f2 (Lei Zhang      2012-08-06 17:05:33 -0700 777)       LOG(ERROR) << "LIBMTP_Detect_Raw_Devices failed with " << err;
0e5015f2 (Lei Zhang      2012-08-06 17:05:33 -0700 778)       return;
0e5015f2 (Lei Zhang      2012-08-06 17:05:33 -0700 779)     }
0e5015f2 (Lei Zhang      2012-08-06 17:05:33 -0700 780)   }

 
djkurtz: If you want to send a 1 line CL, I'd be happy to review it. As you can see from the annotation dates above, I have not touched this code in a while.
Cc: thestig@chromium.org
Owner: yawano@chromium.org
Maybe yawano has more bandwidth and will actually work on this. :)
Labels: CrOSFilesFeature-ExternalMedia
Project Member

Comment 4 by bugdroid1@chromium.org, Sep 28

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/2ddd88b94cecc403bce2c482824df362773269dc

commit 2ddd88b94cecc403bce2c482824df362773269dc
Author: Anand K Mistry <amistry@chromium.org>
Date: Fri Sep 28 02:45:20 2018

mtpd: Suppress LIBMTP_ERROR_NO_DEVICE_ATTACHED error.

LIBMTP_ERROR_NO_DEVICE_ATTACHED isn't an error condition, so don't log
it at the error level. Demote the message to INFO in case it might be
useful for debugging.

BUG= chromium:598287 
TEST=Deploy to chell, look at syslog.

Change-Id: Idd01fb408703a55ef23a34be8f812881126c420a
Reviewed-on: https://chromium-review.googlesource.com/1229634
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Anand Mistry <amistry@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>

[modify] https://crrev.com/2ddd88b94cecc403bce2c482824df362773269dc/mtpd/device_manager.cc

Cc: yawano@chromium.org
Owner: amistry@chromium.org
Status: Fixed (was: Assigned)

Sign in to add a comment