mtp

Merge lp:~cyphermox/mtp/lp1421664 into lp:mtp

Proposed by Mathieu Trudel-Lapierre
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 67
Merged at revision: 64
Proposed branch: lp:~cyphermox/mtp/lp1421664
Merge into: lp:mtp
Diff against target: 27 lines (+4/-2)
2 files modified
debian/mtp-server.conf (+2/-1)
server/server.cpp (+2/-1)
To merge this branch: bzr merge lp:~cyphermox/mtp/lp1421664
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Sebastien Bacher Approve
Ubuntu Phablet Team Pending
Review via email: mp+249669@code.launchpad.net

Commit message

Fix startup issues on desktop: guard against android_usb not being available and don't fail with an abort when /dev/mtp_usb isn't there; just error and return.

Description of the change

Fix startup issues on desktop: guard against android_usb not being available and don't fail with an abort when /dev/mtp_usb isn't there; just error and return.

To post a comment you must log in.
lp:~cyphermox/mtp/lp1421664 updated
66. By Mathieu Trudel-Lapierre

We still need mtp to exit when it fails to open /dev/mtp_usb.

Revision history for this message
Sebastien Bacher (seb128) wrote :

testing with sh it seems to be unhappy about the -o line, complaining about an illegal number, using that instead works
"if [ -z "$disconnected" ] || [ "$disconnected" -ge 1 ];"

not sure what's the issue with the version there (or with my local testing) though

Revision history for this message
Sebastien Bacher (seb128) wrote :

oh, I guess the reason is that the -o runs the second test even when the first one is invalid, or $disconnected is not a number in that case and that leads to the error

lp:~cyphermox/mtp/lp1421664 updated
67. By Mathieu Trudel-Lapierre

Improve on the if check for disconnected state.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

seems fine to me now, thanks

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/mtp-server.conf'
--- debian/mtp-server.conf 2015-01-20 15:38:12 +0000
+++ debian/mtp-server.conf 2015-02-13 16:01:01 +0000
@@ -6,7 +6,8 @@
6pre-start script6pre-start script
7 [ "$USER" != "lightdm" ] || { stop; exit 0; }7 [ "$USER" != "lightdm" ] || { stop; exit 0; }
88
9 if grep -qc DISCONNECTED /sys/devices/virtual/android_usb/android0/state;9 disconnected=`grep -c DISCONNECTED /sys/devices/virtual/android_usb/android0/state`;
10 if [ -z "$disconnected" ] || [ "$disconnected" -ge 1 ];
10 then11 then
11 stop; exit 0;12 stop; exit 0;
12 fi13 fi
1314
=== modified file 'server/server.cpp'
--- server/server.cpp 2014-10-29 18:46:35 +0000
+++ server/server.cpp 2015-02-13 16:01:01 +0000
@@ -421,7 +421,8 @@
421 int fd = open("/dev/mtp_usb", O_RDWR);421 int fd = open("/dev/mtp_usb", O_RDWR);
422 if (fd < 0)422 if (fd < 0)
423 {423 {
424 LOG(FATAL) << "Error opening /dev/mtp_usb, aborting now...";424 LOG(ERROR) << "Error opening /dev/mtp_usb, aborting now...";
425 return 1;
425 }426 }
426 427
427 try {428 try {

Subscribers

People subscribed via source and target branches