Skip to content

Commit

Permalink
fix(adb): incorrect endianness in delayed ack
Browse files Browse the repository at this point in the history
  • Loading branch information
yume-chan committed Apr 30, 2024
1 parent f83ea20 commit 0424dd7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions libraries/adb/src/daemon/dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
delay,
} from "@yume-chan/async";
import {
getUint32BigEndian,
getUint32LittleEndian,
setUint32LittleEndian,
} from "@yume-chan/no-data-view";
import {
Expand Down Expand Up @@ -193,7 +193,7 @@ export class AdbPacketDispatcher implements Closeable {
"Invalid OKAY packet. Payload size should be 4",
);
}
ackBytes = getUint32BigEndian(packet.payload, 0);
ackBytes = getUint32LittleEndian(packet.payload, 0);
} else {
if (packet.payload.byteLength !== 0) {
throw new Error(
Expand Down
2 changes: 1 addition & 1 deletion libraries/adb/src/server/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// cspell:ignore tport

import { PromiseResolver } from "@yume-chan/async";
import { getUint64LittleEndian } from "@yume-chan/no-data-view";
import type {
AbortSignal,
ReadableWritablePair,
Expand Down Expand Up @@ -28,7 +29,6 @@ import { AdbBanner } from "../banner.js";
import type { AdbFeature } from "../features.js";
import { NOOP, hexToNumber, numberToHex, unreachable } from "../utils/index.js";

import { getUint64LittleEndian } from "@yume-chan/no-data-view";
import { AdbServerTransport } from "./transport.js";

export interface AdbServerConnectionOptions {
Expand Down
8 changes: 4 additions & 4 deletions libraries/scrcpy/src/options/1_16/options.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import {
getUint16BigEndian,
getUint32BigEndian,
} from "@yume-chan/no-data-view";
import type { ReadableStream } from "@yume-chan/stream-extra";
import {
BufferedReadableStream,
Expand All @@ -23,10 +27,6 @@ import { ScrcpyVideoCodecId } from "../codec.js";
import type { ScrcpyDisplay, ScrcpyEncoder, ScrcpyOptions } from "../types.js";
import { toScrcpyOptionValue } from "../types.js";

import {
getUint16BigEndian,
getUint32BigEndian,
} from "@yume-chan/no-data-view";
import { CodecOptions } from "./codec-options.js";
import type { ScrcpyOptionsInit1_16 } from "./init.js";
import { ScrcpyLogLevel1_16, ScrcpyVideoOrientation1_16 } from "./init.js";
Expand Down
2 changes: 1 addition & 1 deletion libraries/scrcpy/src/options/2_0.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getUint32BigEndian } from "@yume-chan/no-data-view";
import type { ReadableStream } from "@yume-chan/stream-extra";
import {
BufferedReadableStream,
Expand All @@ -11,7 +12,6 @@ import type {
ScrcpyInjectTouchControlMessage,
} from "../control/index.js";

import { getUint32BigEndian } from "@yume-chan/no-data-view";
import {
CodecOptions,
ScrcpyFloatToUint16FieldDefinition,
Expand Down
1 change: 1 addition & 0 deletions libraries/struct/src/types/number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
getUint16,
getUint32,
} from "@yume-chan/no-data-view";

import type {
AsyncExactReadable,
ExactReadable,
Expand Down

0 comments on commit 0424dd7

Please sign in to comment.