Files
app/native-test/usb_fake_device.cpp
T
Claude 9915decc6d Comments for every function: the last batch; CI checks it
The UI tests, Gradle's script, the iOS app and the native test hosts
(batch 6 of 8, comment lines only) and the checker's own. Every
function in the app is now documented; android.yml's docs job runs
tools/doc_check.py first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0172Hejd12i4aYikYW9vgpZs
2026-10-27 08:23:54 +00:00

38 lines
1.1 KiB
C++

/*
* SPDX-License-Identifier: AGPL-3.0-only
* Copyright (C) 2026 Neo-Desktop
*
* usb_fake_device.cpp - the build host's usb_android.h: the fake
* stick (fake_pico_line.cpp) is found by
* libusb's own calls, no descriptor to wrap
*
*/
#include "usb/usb_android.h"
namespace dmodem_android {
/* (the fake needs no descriptor) a descriptor's use only starts the transfer counts again */
void usb_use_fd(int fd)
{
if (fd >= 0)
usb_transfers_reset();
}
} // namespace dmodem_android
/* (weak: a fake that has its own wins) what the fake leaves to the real libusb (upstream's tests preload the
fake in front of it; here it is linked in alone): the device's ports,
for wake on ring's sysfs switch (UsbLine::arm_wake(), with set_wake()
alone), unknown */
extern "C" __attribute__((weak)) int LIBUSB_CALL libusb_get_port_numbers(libusb_device *,
uint8_t *, int)
{
return LIBUSB_ERROR_NOT_SUPPORTED;
}
/* (the Agere modem's speed check: the fake stick isn't one) */
extern "C" __attribute__((weak)) int LIBUSB_CALL libusb_get_device_speed(libusb_device *)
{
return LIBUSB_SPEED_HIGH;
}