Cross-OS library for implementing USB device-mode interfaces

Overview

libusbd

Cross-OS library for implementing USB device-mode interfaces. WIP. I'm currently working out most of the API details with the programs in examples/.

Current Support

Planned Support

  • Linux FunctionFS
  • Rust bindings

Provided Examples:

  • examples/keyboard: Emulates a HID keyboard that types My laptop is a keyboard. forever.
  • examples/gamepad: Emulates a (Switch-compatible) HORI gamepad.
  • examples/ums: Emulates a USB Mass Storage device from an image file, including writing. Stress tested as a flashdrive-less Ubuntu LiveUSB.
You might also like...
A modern port of Turbo Vision 2.0, the classical framework for text-based user interfaces. Now cross-platform and with Unicode support.
A modern port of Turbo Vision 2.0, the classical framework for text-based user interfaces. Now cross-platform and with Unicode support.

Turbo Vision A modern port of Turbo Vision 2.0, the classical framework for text-based user interfaces. Now cross-platform and with Unicode support. I

If the button pressed esp will reset and App mode will on. App mode will on then led will on, network is connected led will off.

DHT22-to-Google-sheet-Reset-Using-ESP8266-LED-Switch If button pressed esp will reset and App mode will on. App mode will on then led will on, network

Wgeo, or "wi-fi geolocator", is a cross-platform C/C++ library for wifi-based device geolocation, utilising public wireless access point location databases

wgeo Wgeo, or "wi-fi geolocator", is a cross-platform C/C++ library for wifi-based device geolocation, utilising public wireless access point location

A simple C++ library with multi language interfaces (Java, NodeJS, Python...)

cpp-to-x A simple C++ library with multi language interfaces (Java, NodeJS, Python...) Why This is just a learning experiment to see how you can write

Operating system project - implementing scheduling algorithms and some system calls for XV6 OS

About XV6 xv6 is a modern reimplementation of Sixth Edition Unix in ANSI C for multiprocessor x86 and RISC-V systems.

A demonstration of various different techniques for implementing 'threaded code,' a technique used in Forth and in virtual machines like the JVM.

Threaded code is a technique used in the implementation of virtual machines (VMs). It avoids the overhead of calling subroutines repeatedly by 'thread

bsdiff changed to remove bz2, the header and to allow streaming interfaces, to be used on the esp32 with idf as a component

bspatch for esp32 This project adds support for bspatch to the esp32 with some changes: no compression (bz2), no header and changed the interfaces to

The Leap Motion cross-format, cross-platform declarative serialization library

Introduction to LeapSerial LeapSerial is a cross-format, declarative, serialization and deserialization library written and maintained by Leap Motion.

Latest spark library rationalised for a single device

SparkIO3 Latest spark library rationalised for a single device With changes to the interface Connect to devices: connect_to_all(); Start the Spark li

Comments
  • this doesnt work on my machine :(

    this doesnt work on my machine :(

    ok im at a loss here so tell me if you can help me out

    *[main][~/Downloads/libusbd]$ ./build.sh
    rm -f -- libusbd.dylib
    clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -arch arm64 -O1 -Wall -g -fstack-protector-all -I include/ -I src/ -framework CoreFoundation -framework IOKit  -shared -Wl,-undefined -Wl,dynamic_lookup -lpthread -o libusbd.dylib src/libusbd.c src/plat/macos/impl.c src/plat/macos/alt_IOUSBDeviceControllerLib.c
    src/libusbd.c:378:22: warning: unused variable 'pIface' [-Wunused-variable]
        libusbd_iface_t* pIface = &pCtx->aInterfaces[iface_num];
                         ^
    1 warning generated.
    src/plat/macos/impl.c:570:19: warning: unused variable 's_ret' [-Wunused-variable]
        kern_return_t s_ret;
                      ^
    src/plat/macos/impl.c:572:19: warning: unused variable 'open_ret' [-Wunused-variable]
        kern_return_t open_ret;
                      ^
    src/plat/macos/impl.c:671:19: warning: variable 's_ret' set but not used [-Wunused-but-set-variable]
        kern_return_t s_ret;
                      ^
    src/plat/macos/impl.c:726:19: warning: variable 's_ret' set but not used [-Wunused-but-set-variable]
        kern_return_t s_ret;
                      ^
    src/plat/macos/impl.c:728:19: warning: variable 'open_ret' set but not used [-Wunused-but-set-variable]
        kern_return_t open_ret;
                      ^
    src/plat/macos/impl.c:897:19: warning: unused variable 'ret' [-Wunused-variable]
        kern_return_t ret = IOUSBDeviceInterface_CommitConfiguration(pImplCtx, iface_num); // TODO check
                      ^
    src/plat/macos/impl.c:970:19: warning: unused variable 'ret' [-Wunused-variable]
        kern_return_t ret = IOUSBDeviceInterface_CreatePipe(pImplCtx, iface_num, type, direction, maxPktSize, interval, unk, pEpOut);
                      ^
    src/plat/macos/impl.c:1015:17: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
            if (ret = libusbd_impl_iface_alloc_builtin_internal(pCtx, "AppleUSBNCMControl")) return ret;
                ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/plat/macos/impl.c:1015:17: note: place parentheses around the assignment to silence this warning
            if (ret = libusbd_impl_iface_alloc_builtin_internal(pCtx, "AppleUSBNCMControl")) return ret;
                    ^
                (                                                                          )
    src/plat/macos/impl.c:1015:17: note: use '==' to turn this assignment into an equality comparison
            if (ret = libusbd_impl_iface_alloc_builtin_internal(pCtx, "AppleUSBNCMControl")) return ret;
                    ^
                    ==
    src/plat/macos/impl.c:1017:17: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
            if (ret = libusbd_impl_iface_alloc_builtin_internal(pCtx, "AppleUSBNCMData")) return ret;
                ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/plat/macos/impl.c:1017:17: note: place parentheses around the assignment to silence this warning
            if (ret = libusbd_impl_iface_alloc_builtin_internal(pCtx, "AppleUSBNCMData")) return ret;
                    ^
                (                                                                       )
    src/plat/macos/impl.c:1017:17: note: use '==' to turn this assignment into an equality comparison
            if (ret = libusbd_impl_iface_alloc_builtin_internal(pCtx, "AppleUSBNCMData")) return ret;
                    ^
                    ==
    src/plat/macos/impl.c:1022:17: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
            if (ret = libusbd_impl_iface_alloc_builtin_internal(pCtx, name)) return ret;
                ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    src/plat/macos/impl.c:1022:17: note: place parentheses around the assignment to silence this warning
            if (ret = libusbd_impl_iface_alloc_builtin_internal(pCtx, name)) return ret;
                    ^
                (                                                          )
    src/plat/macos/impl.c:1022:17: note: use '==' to turn this assignment into an equality comparison
            if (ret = libusbd_impl_iface_alloc_builtin_internal(pCtx, name)) return ret;
                    ^
                    ==
    10 warnings generated.
    codesign -s - libusbd.dylib
    *[main][~/Downloads/libusbd]$ cd examples/keyboard/ ; make clean && make && cp ./example_keyboard ../../ && cd ../../ && ./example_keyboard
    rm -f -- example_keyboard
    clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -arch arm64 -O1 -Wall -g -fstack-protector-all -isystem ../../include -framework CoreFoundation -framework IOKit  -L../.. -lusbd -o example_keyboard main.c
    codesign -s - example_keyboard
    libusbd macos: Start runloop
    libusbd macos: Connecting to: 'IOService:/AppleARMPE/[email protected]/AppleT810xIO/[email protected]/[email protected]/gay_bowser_usbgadget'
    [1]    2668 killed     ./example_keyboard
    *[main][~/Downloads/libusbd]$
    

    i've loaded the kext and i think that works fine ?? i dont know what to do now let me know if you have anything macos 12.5 m1 air 2020 i've also changed usb-drd2 to usb-drd1

    opened by dm4uz3 0
Owner
Max Thomas
I do reverse engineering work, vulnerability research, hardware drivers, modding tools and VR tinkering. Currently working at Ultraleap.
Max Thomas
Tiny and portable usb host and device stack for mcu with usb ip

Tiny and portable usb host and device stack for mcu with usb ip

sakumisu 501 Nov 18, 2022
A framework for implementing block device drivers in user space

BDUS is a Linux 4.0+ framework for developing block devices in user space. More specifically, it enables you to implement block device drivers as regu

Alberto Faria 26 May 24, 2022
Linux USB driver for the MOTU AVB series interfaces

motu-avb Linux USB driver for the MOTU AVB series interfaces Kernel parameters: samplerate: set the samplerate (its currently fixed at module load) de

null 46 Nov 6, 2022
ESP32 software USB host through general IO pins. We can connect up to 4 USB-LS HID (keyboard mouse joystick) devices simultaneously.

esp32_usb_soft_host esp32 USB-LS pure software host thru general IO pins. Up to 4 HID devices simultaneously. board ~$3 :https://www.aliexpress.com/pr

Samsonov Dima 304 Nov 25, 2022
ESP8266 software USB host through general IO pins. We can connect up to 2 USB-LS HID (keyboard mouse joystick) devices simultaneously.

esp8266_usb_soft_host Test for esp8266 usb host . Works with ESP-IDF v3.4 80MHz and 160MHz. WorkInProgress Test run with mouse & combined mouse & keyb

Samsonov Dima 28 Sep 1, 2022
USB-C_PCB_experiments - USB-C ports made from a flex PCB and an ATtiny84A

USB-C PCB Experiments This is part of an ongoing series of projects involving creative interpretations of the USB mechanical standards. You've probabl

Sam Ettinger 23 Sep 5, 2022
Anotter USB temperature logger that can record up to four channels with thermocouple or NTCs connected via CDC directly or SCPI to USB.

temperature-logger Anotter USB temperature logger that can record up to four channels with thermocouple or NTCs connected via CDC directly or SCPI to

Jana Marie Hemsing 50 Nov 24, 2022
BMI_automatics-faceshielding-device - this is a project utilizing STM32, MATLAB,Softmax classifier to achieve a portable face shielding(mask) device

BMI_automatics-faceshielding-device this is a project utilizing STM32, MATLAB,Softmax classifier to achieve a portable face shielding(mask) device in

Lyu Tian 2 Dec 23, 2021
Windows kernel-mode driver emulating well-known USB game controllers.

Windows kernel-mode driver emulating well-known USB game controllers.

Virtual Gamepad Emulation Framework 1.7k Nov 23, 2022
Streaming video over USB 3.0 using MAX10 FPGA and CYUSB3014 synchronous slave mode.

DECA_USB3_Cam Streaming video over USB 3.0 using MAX10 FPGA and CYUSB3014 synchronous slave mode. Video: Block diagram _______

Dmitry Koroteev 9 Apr 18, 2022