adb: Android serial numbers are not all 16 characters long, so accept other lengths.

I can't find any documentation of how long it should be. Hard to imagine
it being shorter than 4 characters though, so put that in as a conservative
lower bound.

This commit was sponsored by Nick Piper on Patreon.
This commit is contained in:
Joey Hess 2018-06-12 13:56:01 -04:00
parent 98168e8f2e
commit 90a3afb60f
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 14 additions and 1 deletions

View file

@ -9,6 +9,8 @@ git-annex (6.20180530) UNRELEASED; urgency=medium
is configured. is configured.
* External special remotes can now add info to `git annex info $remote`, * External special remotes can now add info to `git annex info $remote`,
by replying to the GETINFO message. by replying to the GETINFO message.
* adb: Android serial numbers are not all 16 characters long, so accept
other lengths.
-- Joey Hess <id@joeyh.name> Wed, 30 May 2018 11:49:08 -0400 -- Joey Hess <id@joeyh.name> Wed, 30 May 2018 11:49:08 -0400

View file

@ -236,7 +236,7 @@ enumerateAdbConnected =
where where
parse l = parse l =
let (serial, desc) = separate (== '\t') l let (serial, desc) = separate (== '\t') l
in if null desc || length serial /= 16 in if null desc || length serial < 4
then Nothing then Nothing
else Just (AndroidSerial serial) else Just (AndroidSerial serial)

View file

@ -20,3 +20,4 @@ git-annex claims that adb does not list any devices. `adb devices` however shows
upgrade supported from repository versions: 0 1 2 3 4 5 upgrade supported from repository versions: 0 1 2 3 4 5
operating system: linux x86_64 operating system: linux x86_64
> [[fixed|done]] --[[Joey]]

View file

@ -0,0 +1,10 @@
[[!comment format=mdwn
username="joey"
subject="""comment 1"""
date="2018-06-12T17:39:51Z"
content="""
It's expecting a serial number 16 digits long,
and your adb is using a 12 digit one. I suppose this means that the length
can vary. Hopefully because of a difference in the android device and not
the version of adb. I'll change it to accept shorter serials.
"""]]