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
1=== modified file 'debian/mtp-server.conf'
2--- debian/mtp-server.conf 2015-01-20 15:38:12 +0000
3+++ debian/mtp-server.conf 2015-02-13 16:01:01 +0000
4@@ -6,7 +6,8 @@
5 pre-start script
6 [ "$USER" != "lightdm" ] || { stop; exit 0; }
7
8- 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 ];
11 then
12 stop; exit 0;
13 fi
14
15=== modified file 'server/server.cpp'
16--- server/server.cpp 2014-10-29 18:46:35 +0000
17+++ server/server.cpp 2015-02-13 16:01:01 +0000
18@@ -421,7 +421,8 @@
19 int fd = open("/dev/mtp_usb", O_RDWR);
20 if (fd < 0)
21 {
22- LOG(FATAL) << "Error opening /dev/mtp_usb, aborting now...";
23+ LOG(ERROR) << "Error opening /dev/mtp_usb, aborting now...";
24+ return 1;
25 }
26
27 try {

Subscribers

People subscribed via source and target branches