Re: Okay, I give up… how to connect my (Android) phone properly (MTP)?

Johnny Rosenberg gurus.knugum at gmail.com
Fri Aug 7 18:09:57 UTC 2015


2015-08-07 14:06 GMT+02:00 Nils Kassube <kassube at gmx.net>:

> Johnny Rosenberg wrote:
> > 2015-08-07 10:43 GMT+02:00 Nils Kassube <kassube at gmx.net>:
> > > Johnny Rosenberg wrote:
> > > > My script has another bug that will happen if there is more than
> > > > one
> > > > folder in ”/run/user”. That can happen and it happened when I
> > > > switched user to my wife's account. For a moment there was a
> > > > directory called ”112”, which is ”lightdm” and it messed up my log
> > > > file a bit.
> > >
> > > An easy way to find the (hopefully) correct path would be to use
> > > "/run/user/$UID". As I understand it, your final path should be
> > > "/run/user/$UID/gvfs/mtp:host=%5Busb%3A001%2C011%5D". If you even
> > > want to avoid the $UID, you could even use
> > > "/run/user/*/gvfs/mtp:host=%5Busb%3A001%2C011%5D".
> >
> > No, the script is run from the system, so there is no UID or any
> > environment variables at all except those related to Udev.
>
> Silly me - of course there is no useful UID for a script run by udev.
> Thinking about it, you may have a problem if there are several users
> active at the same time. Then there should be several directories in
> /run/user and I don't think you have a way to decide for which user you
> should make the device available.
>
> > The ”/run/user/*/gvfs…” thing is however something that I didn't think
> > of. I'll experiment a bit with it.
>
> Hmm, I think that idea wasn't useful either. After all the path does not
> yet exist, so the wildcard doesn't help here.
>

Well, I noticed that the path doesn't exist until the script is completely
executed, BUT I work around that by having a script that starts another one
in the background. The starter script will then finish very quickly, then
the path will exist and the script that now is running in the background
only has to search for it until it finds it. Unfortunately my if statement
that tests if the path exists gives false even if true, and that's what
bothers me at the moment. The loop gets eternal, but while it's running I
can verify that the path exists, still the script doesn't come out of the
loop.


Johnny Rosenberg


>
>
> Nils
>
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20150807/f2213a2b/attachment.html>


More information about the ubuntu-users mailing list