public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Why is "mtp-probe" running when I plug in a USB device?
@ 2022-01-21 21:23 Grant Edwards
  2022-01-21 21:26 ` [gentoo-user] " Grant Edwards
  2022-01-21 22:04 ` [gentoo-user] " Rich Freeman
  0 siblings, 2 replies; 3+ messages in thread
From: Grant Edwards @ 2022-01-21 21:23 UTC (permalink / raw
  To: gentoo-user

I've noticed that whenever I plug in any sort of USB device,
"mtp-probe" runs and logs the fact that the newly attached thing "was
not an MTP device".

This appears to be triggered by a rule in

   /lib/udev/rules.d/69-libmtp.rules

which is owned by media-libs/libmtp

Why does that library think it should be probing every USB device I
plug in? Is that automatic probing required for libmtp and mtpfs to
work?

I do _not_ want anything to happen "automagically" when I plug in a
USB mtp device. I know if a device is an MTP device, and if I want it
mounted, I'll mount it manually.

--
Grant






^ permalink raw reply	[flat|nested] 3+ messages in thread

* [gentoo-user] Re: Why is "mtp-probe" running when I plug in a USB device?
  2022-01-21 21:23 [gentoo-user] Why is "mtp-probe" running when I plug in a USB device? Grant Edwards
@ 2022-01-21 21:26 ` Grant Edwards
  2022-01-21 22:04 ` [gentoo-user] " Rich Freeman
  1 sibling, 0 replies; 3+ messages in thread
From: Grant Edwards @ 2022-01-21 21:26 UTC (permalink / raw
  To: gentoo-user

On 2022-01-21, Grant Edwards <grant.b.edwards@gmail.com> wrote:
> [...]
>
> This appears to be triggered by a rule in
>
>    /lib/udev/rules.d/69-libmtp.rules
>
> which is owned by media-libs/libmtp
>
> Why does that library think it should be probing every USB device I
> [...]

Oh, and tell those damn kids to GET OFF MY LAWN!

--
Grant



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [gentoo-user] Why is "mtp-probe" running when I plug in a USB device?
  2022-01-21 21:23 [gentoo-user] Why is "mtp-probe" running when I plug in a USB device? Grant Edwards
  2022-01-21 21:26 ` [gentoo-user] " Grant Edwards
@ 2022-01-21 22:04 ` Rich Freeman
  1 sibling, 0 replies; 3+ messages in thread
From: Rich Freeman @ 2022-01-21 22:04 UTC (permalink / raw
  To: gentoo-user

On Fri, Jan 21, 2022 at 4:23 PM Grant Edwards <grant.b.edwards@gmail.com> wrote:
>
> Why does that library think it should be probing every USB device I
> plug in? Is that automatic probing required for libmtp and mtpfs to
> work?

I'm guessing that MTP cannot be detected by just looking at a device
ID/etc and requires some kind of interrogation.  It looks like libmtp
is designed to create a device node /dev/libmtp-1-4 which I'm guessing
it uses for later operations like mounting/etc.  Doing this at time of
insertion makes the most sense, since that is how most device nodes
work.

Note that anytime you plug in a USB device, or just about any other
device, code tends to run.  When a sound device raises an IRQ to call
attention to its buffer being exhausted, code tends to run.  When a
hard drive is asked to read a block off the disk and has it available
to read, it likely raises an interrupt, and code runs.  Much of this
code is in the kernel, but there is a general trend towards moving
more of this stuff into userspace, so now you notice it more, vs it
just showing up as a system % cpu figure in top with little
transparency into what is going on if you aren't actually doing traces
of some kind.  With tools like udev more of this is configurable as
you've noticed.

I wouldn't view any of this as a bad thing.  You're more aware of it
now, and you have more control over it now, and if the code does the
run thing it is more likely to be running as nobody instead of as the
kernel.

Why should it be strange that when you plug in a device, the operating
system tries to figure out what sort of device it is, and set it up so
that you can access it from userspace?

> I do _not_ want anything to happen "automagically" when I plug in a
> USB mtp device. I know if a device is an MTP device, and if I want it
> mounted, I'll mount it manually.

Well, you can of course disable the udev rule.  I'm not sure if there
are issues with running device probing on demand.  Obviously the whole
udev framework is designed to dynamically create and destroy device
nodes as devices are plugged in or removed.

Would you want /dev/sdb to not exist until you're ready to mount the
disk drive?  Perhaps you would want to run some command line
identifying the disk by its host and port or something, so that it can
create /dev/sdb, and then you can mount it normally from there?

Should ALSA devices not exist until the first time you're ready to
play a sound?  Then you run something as root to configure them?

-- 
Rich


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-21 22:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-21 21:23 [gentoo-user] Why is "mtp-probe" running when I plug in a USB device? Grant Edwards
2022-01-21 21:26 ` [gentoo-user] " Grant Edwards
2022-01-21 22:04 ` [gentoo-user] " Rich Freeman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox