python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / tools / misc / android-tools / android-tools-kernel-headers-6.0.diff
blob38c0c9f394911d9107f1175fd74ca109b245799d
1 diff --git a/vendor/adb/client/usb_linux.cpp b/vendor/adb/client/usb_linux.cpp
2 index 25a50bd..0d09c47 100644
3 --- a/vendor/adb/client/usb_linux.cpp
4 +++ b/vendor/adb/client/usb_linux.cpp
5 @@ -59,8 +59,15 @@ using namespace std::literals;
6 #define DBGX(x...)
8 struct usb_handle {
9 + usb_handle() : urb_in(0), urb_out(0) {
10 + this->urb_in = new usbdevfs_urb;
11 + this->urb_out = new usbdevfs_urb;
12 + }
14 ~usb_handle() {
15 if (fd != -1) unix_close(fd);
16 + delete urb_in;
17 + delete urb_out;
20 std::string path;
21 @@ -72,8 +79,8 @@ struct usb_handle {
22 unsigned zero_mask;
23 unsigned writeable = 1;
25 - usbdevfs_urb urb_in;
26 - usbdevfs_urb urb_out;
27 + usbdevfs_urb *urb_in;
28 + usbdevfs_urb *urb_out;
30 bool urb_in_busy = false;
31 bool urb_out_busy = false;
32 @@ -304,7 +311,7 @@ static int usb_bulk_write(usb_handle* h, const void* data, int len) {
33 std::unique_lock<std::mutex> lock(h->mutex);
34 D("++ usb_bulk_write ++");
36 - usbdevfs_urb* urb = &h->urb_out;
37 + usbdevfs_urb* urb = h->urb_out;
38 memset(urb, 0, sizeof(*urb));
39 urb->type = USBDEVFS_URB_TYPE_BULK;
40 urb->endpoint = h->ep_out;
41 @@ -343,7 +350,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) {
42 std::unique_lock<std::mutex> lock(h->mutex);
43 D("++ usb_bulk_read ++");
45 - usbdevfs_urb* urb = &h->urb_in;
46 + usbdevfs_urb* urb = h->urb_in;
47 memset(urb, 0, sizeof(*urb));
48 urb->type = USBDEVFS_URB_TYPE_BULK;
49 urb->endpoint = h->ep_in;
50 @@ -388,7 +395,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) {
52 D("[ urb @%p status = %d, actual = %d ]", out, out->status, out->actual_length);
54 - if (out == &h->urb_in) {
55 + if (out == h->urb_in) {
56 D("[ reap urb - IN complete ]");
57 h->urb_in_busy = false;
58 if (urb->status != 0) {
59 @@ -397,7 +404,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) {
61 return urb->actual_length;
63 - if (out == &h->urb_out) {
64 + if (out == h->urb_out) {
65 D("[ reap urb - OUT compelete ]");
66 h->urb_out_busy = false;
67 h->cv.notify_all();
68 @@ -501,10 +508,10 @@ void usb_kick(usb_handle* h) {
69 ** but this ensures that a reader blocked on REAPURB
70 ** will get unblocked
72 - ioctl(h->fd, USBDEVFS_DISCARDURB, &h->urb_in);
73 - ioctl(h->fd, USBDEVFS_DISCARDURB, &h->urb_out);
74 - h->urb_in.status = -ENODEV;
75 - h->urb_out.status = -ENODEV;
76 + ioctl(h->fd, USBDEVFS_DISCARDURB, h->urb_in);
77 + ioctl(h->fd, USBDEVFS_DISCARDURB, h->urb_out);
78 + h->urb_in->status = -ENODEV;
79 + h->urb_out->status = -ENODEV;
80 h->urb_in_busy = false;
81 h->urb_out_busy = false;
82 h->cv.notify_all();