tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
android-tools: 33.0.3 -> 33.0.3p1
Weijia Wang
3 years ago
28609af5
a1f49c04
+9
-104
2 changed files
expand all
collapse all
unified
split
pkgs
tools
misc
android-tools
android-tools-kernel-headers-6.0.diff
default.nix
-82
pkgs/tools/misc/android-tools/android-tools-kernel-headers-6.0.diff
···
1
1
-
diff --git a/vendor/adb/client/usb_linux.cpp b/vendor/adb/client/usb_linux.cpp
2
2
-
index 25a50bd..0d09c47 100644
3
3
-
--- a/vendor/adb/client/usb_linux.cpp
4
4
-
+++ b/vendor/adb/client/usb_linux.cpp
5
5
-
@@ -59,8 +59,15 @@ using namespace std::literals;
6
6
-
#define DBGX(x...)
7
7
-
8
8
-
struct usb_handle {
9
9
-
+ usb_handle() : urb_in(0), urb_out(0) {
10
10
-
+ this->urb_in = new usbdevfs_urb;
11
11
-
+ this->urb_out = new usbdevfs_urb;
12
12
-
+ }
13
13
-
+
14
14
-
~usb_handle() {
15
15
-
if (fd != -1) unix_close(fd);
16
16
-
+ delete urb_in;
17
17
-
+ delete urb_out;
18
18
-
}
19
19
-
20
20
-
std::string path;
21
21
-
@@ -72,8 +79,8 @@ struct usb_handle {
22
22
-
unsigned zero_mask;
23
23
-
unsigned writeable = 1;
24
24
-
25
25
-
- usbdevfs_urb urb_in;
26
26
-
- usbdevfs_urb urb_out;
27
27
-
+ usbdevfs_urb *urb_in;
28
28
-
+ usbdevfs_urb *urb_out;
29
29
-
30
30
-
bool urb_in_busy = false;
31
31
-
bool urb_out_busy = false;
32
32
-
@@ -304,7 +311,7 @@ static int usb_bulk_write(usb_handle* h, const void* data, int len) {
33
33
-
std::unique_lock<std::mutex> lock(h->mutex);
34
34
-
D("++ usb_bulk_write ++");
35
35
-
36
36
-
- usbdevfs_urb* urb = &h->urb_out;
37
37
-
+ usbdevfs_urb* urb = h->urb_out;
38
38
-
memset(urb, 0, sizeof(*urb));
39
39
-
urb->type = USBDEVFS_URB_TYPE_BULK;
40
40
-
urb->endpoint = h->ep_out;
41
41
-
@@ -343,7 +350,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) {
42
42
-
std::unique_lock<std::mutex> lock(h->mutex);
43
43
-
D("++ usb_bulk_read ++");
44
44
-
45
45
-
- usbdevfs_urb* urb = &h->urb_in;
46
46
-
+ usbdevfs_urb* urb = h->urb_in;
47
47
-
memset(urb, 0, sizeof(*urb));
48
48
-
urb->type = USBDEVFS_URB_TYPE_BULK;
49
49
-
urb->endpoint = h->ep_in;
50
50
-
@@ -388,7 +395,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) {
51
51
-
}
52
52
-
D("[ urb @%p status = %d, actual = %d ]", out, out->status, out->actual_length);
53
53
-
54
54
-
- if (out == &h->urb_in) {
55
55
-
+ if (out == h->urb_in) {
56
56
-
D("[ reap urb - IN complete ]");
57
57
-
h->urb_in_busy = false;
58
58
-
if (urb->status != 0) {
59
59
-
@@ -397,7 +404,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) {
60
60
-
}
61
61
-
return urb->actual_length;
62
62
-
}
63
63
-
- if (out == &h->urb_out) {
64
64
-
+ if (out == h->urb_out) {
65
65
-
D("[ reap urb - OUT compelete ]");
66
66
-
h->urb_out_busy = false;
67
67
-
h->cv.notify_all();
68
68
-
@@ -501,10 +508,10 @@ void usb_kick(usb_handle* h) {
69
69
-
** but this ensures that a reader blocked on REAPURB
70
70
-
** will get unblocked
71
71
-
*/
72
72
-
- ioctl(h->fd, USBDEVFS_DISCARDURB, &h->urb_in);
73
73
-
- ioctl(h->fd, USBDEVFS_DISCARDURB, &h->urb_out);
74
74
-
- h->urb_in.status = -ENODEV;
75
75
-
- h->urb_out.status = -ENODEV;
76
76
-
+ ioctl(h->fd, USBDEVFS_DISCARDURB, h->urb_in);
77
77
-
+ ioctl(h->fd, USBDEVFS_DISCARDURB, h->urb_out);
78
78
-
+ h->urb_in->status = -ENODEV;
79
79
-
+ h->urb_out->status = -ENODEV;
80
80
-
h->urb_in_busy = false;
81
81
-
h->urb_out_busy = false;
82
82
-
h->cv.notify_all();
+9
-22
pkgs/tools/misc/android-tools/default.nix
···
1
1
{ lib, stdenv, fetchurl, fetchpatch
2
2
-
, cmake, perl, go, python3
2
2
+
, cmake, pkg-config, perl, go, python3
3
3
, protobuf, zlib, gtest, brotli, lz4, zstd, libusb1, pcre2
4
4
}:
5
5
···
9
9
10
10
stdenv.mkDerivation rec {
11
11
pname = "android-tools";
12
12
-
version = "33.0.3";
12
12
+
version = "33.0.3p1";
13
13
14
14
src = fetchurl {
15
15
url = "https://github.com/nmeum/android-tools/releases/download/${version}/android-tools-${version}.tar.xz";
16
16
-
hash = "sha256-jOF02reB1d69Ke0PllciMfd3vuGbjvPBZ+M9PqdnC8U=";
16
16
+
hash = "sha256-viBHzyVgUWdK9a60u/7SdpiVEvgNEZHihkyRkGH5Ydg=";
17
17
};
18
18
19
19
patches = [
20
20
-
./android-tools-kernel-headers-6.0.diff
20
20
+
(fetchpatch {
21
21
+
name = "add-macos-platform.patch";
22
22
+
url = "https://github.com/nmeum/android-tools/commit/a1ab35b31525966e0f0770047cd82accb36d025b.patch";
23
23
+
hash = "sha256-6O3ekDf0qPdzcfINFF8Ae4XOYgnQWTBhvu9SCFSHkXY=";
24
24
+
})
21
25
];
22
26
23
23
-
postPatch = lib.optionalString stdenv.isDarwin ''
24
24
-
sed -i 's/usb_linux/usb_osx/g' vendor/CMakeLists.{adb,fastboot}.txt
25
25
-
sed -i 's/libselinux libsepol/ /g;s#selinux/libselinux/include##g' vendor/CMakeLists.{fastboot,mke2fs}.txt
26
26
-
sed -z -i 's/add_library(libselinux.*selinux\/libsepol\/include)//g' vendor/CMakeLists.fastboot.txt
27
27
-
sed -i 's/e2fsdroid//g' vendor/CMakeLists.txt
28
28
-
sed -z -i 's/add_executable(e2fsdroid.*e2fsprogs\/misc)//g' vendor/CMakeLists.mke2fs.txt
29
29
-
'';
30
30
-
31
31
-
nativeBuildInputs = [ cmake perl go ];
27
27
+
nativeBuildInputs = [ cmake pkg-config perl go ];
32
28
buildInputs = [ protobuf zlib gtest brotli lz4 zstd libusb1 pcre2 ];
33
29
propagatedBuildInputs = [ pythonEnv ];
34
30
35
31
# Don't try to fetch any Go modules via the network:
36
32
GOFLAGS = [ "-mod=vendor" ];
37
37
-
38
38
-
NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [
39
39
-
"-D_DARWIN_C_SOURCE"
40
40
-
];
41
41
-
42
42
-
NIX_LDFLAGS = lib.optionals stdenv.isDarwin [
43
43
-
"-framework CoreFoundation"
44
44
-
"-framework IOKit"
45
45
-
];
46
33
47
34
preConfigure = ''
48
35
export GOCACHE=$TMPDIR/go-cache