Code Monkey home page Code Monkey logo

karabiner-driverkit-virtualhiddevice's Introduction

Build Status License

Karabiner-DriverKit-VirtualHIDDevice

Virtual devices (keyboard and mouse) implementation for macOS using DriverKit.

Supported systems

  • macOS 14 Sonoma
    • Both Intel-based Macs and Apple Silicon Macs
  • macOS 13 Ventura
    • Both Intel-based Macs and Apple Silicon Macs
  • macOS 12 Monterey
    • Both Intel-based Macs and Apple Silicon Macs
  • macOS 11 Big Sur
    • Both Intel-based Macs and Apple Silicon Macs

Status

  • Implemented:
    • Extension manager
    • Virtual HID keyboard
    • Virtual HID pointing
    • Virtual HID device client

Documents

Screenshots

  • System Preferences (macOS detects the virtual keyboard)

    System Preferences


Usage

  1. Open dist/Karabiner-DriverKit-VirtualHIDDevice-x.x.x.pkg.

  2. Install files via installer.

  3. Execute the following command in Terminal.

    /Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Manager activate
  4. Run a client program to test the driver extension.

    git clone --depth 1 https://github.com/pqrs-org/Karabiner-DriverKit-VirtualHIDDevice.git
    cd Karabiner-DriverKit-VirtualHIDDevice/examples/virtual-hid-device-service-client
    brew install xcodegen
    make
    make run

Uninstallation

  1. Run uninstaller in Terminal.

    bash '/Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/scripts/uninstall/deactivate_driver.sh'
    sudo bash '/Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/scripts/uninstall/remove_files.sh'

Installed files

  • /Applications/.Karabiner-VirtualHIDDevice-Manager.app
  • /Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice
  • /Library/LaunchDaemons/org.pqrs.Karabiner-DriverKit-VirtualHIDDeviceClient.plist
  • /Library/Application Support/org.pqrs/tmp
  • /var/log/karabiner

For developers

How to build

System requirements to build Karabiner-Elements:

  • macOS 11+
  • Xcode 13.0 (You need to hold Xcode version to 13.0 because Xcode 13.1 generate binary which does not work on macOS 11 Big Sur.)
  • Command Line Tools for Xcode
  • XcodeGen

Note

A provisioning profile which supports com.apple.developer.driverkit is required to build a driver extension since Xcode 12.

If you want to start without a valid provisioning profile, use Xcode 11 and Karabiner-DriverKit-VirtualHIDDevice v0.11.0.

Steps

  1. Gain the DriverKit entitlements to be able to create a provisioning profile which supports com.apple.developer.driverkit. Specifically, follow the instructions on Requesting Entitlements for DriverKit Development

    Note: This process may take some time to complete on Apple's end.

    If you want to start without the request, use Xcode 11 and Karabiner-DriverKit-VirtualHIDDevice v0.11.0. (See above note)

  2. Create a Developer ID distribution provisioning profile for org.pqrs.Karabiner-DriverKit-VirtualHIDDevice with com.apple.developer.driverkit entitlement.

    Generate a Provisioning Profile
  3. Replace CODE_SIGN_IDENTITY at src/scripts/codesign.sh with yours.

    Find your codesign identity by executing the following command in Terminal.

    security find-identity -p codesigning -v

    The result is as follows.

    1) 8D660191481C98F5C56630847A6C39D95C166F22 "Developer ID Application: Fumihiko Takayama (G43BCU2T37)"
    2) 6B9AF0D3B3147A69C5E713773ADD9707CB3480D9 "Apple Development: Fumihiko Takayama (YVB3SM6ECS)"
    3) 637B86ED1C06AE99854E9F5A5DCE02DA58F2BBF4 "Mac Developer: Fumihiko Takayama (YVB3SM6ECS)"
    4) 987BC26C6474DF0C0AF8BEA797354873EC83DC96 "Apple Distribution: Fumihiko Takayama (G43BCU2T37)"
        4 valid identities found
    

    Choose one of them (e.g., 8D660191481C98F5C56630847A6C39D95C166F22) and replace existing CODE_SIGN_IDENTITY with yours as follows.

    # Replace with your identity
    readonly CODE_SIGN_IDENTITY=8D660191481C98F5C56630847A6C39D95C166F22
  4. Replace team identifier, domain and embedded.provisionprofile.

    • Search G43BCU2T37 and replace them with your team identifier.

      git grep G43BCU2T37 src/
    • Search org.pqrs and org_pqrs, then replace them with your domain.

      git grep org.pqrs src/
      git grep org_pqrs src/
    • Replace embedded.provisionprofile file with yours.

      find * -name 'embedded.provisionprofile'
  5. Build by the following command in terminal.

    make package

    dist/Karabiner-DriverKit-VirtualHIDDevice-X.X.X.pkg will be generated.

Components

Karabiner-DriverKit-VirtualHIDDevice consists the following components.

  • Extension Manager (including DriverKit driver)
    • /Applications/.Karabiner-VirtualHIDDevice-Manager.app
    • It provides a command line interface to activate or deactivate DriverKit driver.
  • VirtualHIDDeviceClient
    • /Library/Application Support/org.pqrs/Karabiner-DriverKit-VirtualHIDDevice/Applications/Karabiner-DriverKit-VirtualHIDDeviceClient.app
    • It mediates between the client app and the driver.
    • It allows apps to communicate with the virtual device even if the app is not signed with pqrs.org's code signing identity. (The client app must be running with root privileges.)
  • Client apps
    • Client apps are not included in the distributed package.
    • For example, you can build the client app from examples/virtual-hid-device-service-client in this repository.
    • Client apps can send input events by communicating with VirtualHIDDeviceClient via UNIX domain socket. (/Library/Application Support/org.pqrs/tmp/rootonly/vhidd_server/*.sock)

components.svg

Version files

  • version:
    • Karabiner-DriverKit-VirtualHIDDevice package version.
    • Increment when any components are updated.
  • driver-version:
    • DriverKit driver internal version.
    • Increment when the driver source code is updated.

karabiner-driverkit-virtualhiddevice's People

Contributors

claybridges avatar kant avatar tekezo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

karabiner-driverkit-virtualhiddevice's Issues

How to add a function about "pressure"

Hi friend, i want add a function about "pressure" in VirtualHIDPointing, and i added USAGE (Tip Pressure) in
reportDescriptor_[]

    0x05, 0x0d,                         //     USAGE_PAGE (Digitizers)      
    0x09, 0x30,                         //     USAGE (Tip Pressure)         
    0x26, 0xff, 0x03,                   //     LOGICAL_MAXIMUM (1023)        
    0x81, 0x02,                         //     INPUT (Data,Var,Abs)  

And i modified pqrs::karabiner::driverkit::virtual_hid_device::hid_report::pointing_input

  buttons buttons;
  uint8_t x;
  uint8_t y;
  uint8_t vertical_wheel;
  uint8_t horizontal_wheel;
  uint16_t tip_pressur;

But this cannot work.

I found a "Report" about "Windows pen device" at Sample Report Descriptors, But I don't know how to use it.

// Integrated Windows Pen TLC
    0x05, 0x0d,                         // USAGE_PAGE (Digitizers)          
    0x09, 0x02,                         // USAGE (Pen)                      
    0xa1, 0x01,                         // COLLECTION (Application)         
    0x85, REPORTID_PEN,                 //   REPORT_ID (Pen)                
    0x09, 0x20,                         //   USAGE (Stylus)                 
    0xa1, 0x00,                         //   COLLECTION (Physical)          
    0x09, 0x42,                         //     USAGE (Tip Switch)           
    0x09, 0x44,                         //     USAGE (Barrel Switch)        
    0x09, 0x3c,                         //     USAGE (Invert)               
    0x09, 0x45,                         //     USAGE (Eraser Switch)        
    0x15, 0x00,                         //     LOGICAL_MINIMUM (0)          
    0x25, 0x01,                         //     LOGICAL_MAXIMUM (1)          
    0x75, 0x01,                         //     REPORT_SIZE (1)              
    0x95, 0x04,                         //     REPORT_COUNT (4)             
    0x81, 0x02,                         //     INPUT (Data,Var,Abs)         
    0x95, 0x01,                         //     REPORT_COUNT (1)             
    0x81, 0x03,                         //     INPUT (Cnst,Var,Abs)         
    0x09, 0x32,                         //     USAGE (In Range)             
    0x81, 0x02,                         //     INPUT (Data,Var,Abs)         
    0x95, 0x02,                         //     REPORT_COUNT (2)             
    0x81, 0x03,                         //     INPUT (Cnst,Var,Abs)         
    0x05, 0x01,                         //     USAGE_PAGE (Generic Desktop) 
    0x09, 0x30,                         //     USAGE (X)                    
    0x75, 0x10,                         //     REPORT_SIZE (16)             
    0x95, 0x01,                         //     REPORT_COUNT (1)             
    0xa4,                               //     PUSH                         
    0x55, 0x0d,                         //     UNIT_EXPONENT (-3)           
    0x65, 0x13,                         //     UNIT (Inch,EngLinear)        
    0x35, 0x00,                         //     PHYSICAL_MINIMUM (0)         
    0x46, 0x3a, 0x20,                   //     PHYSICAL_MAXIMUM (8250)      
    0x26, 0xf8, 0x52,                   //     LOGICAL_MAXIMUM (21240)      
    0x81, 0x02,                         //     INPUT (Data,Var,Abs)         
    0x09, 0x31,                         //     USAGE (Y)                    
    0x46, 0x2c, 0x18,                   //     PHYSICAL_MAXIMUM (6188)      
    0x26, 0x6c, 0x3e,                   //     LOGICAL_MAXIMUM (15980)      
    0x81, 0x02,                         //     INPUT (Data,Var,Abs)         
    0xb4,                               //     POP                          
    0x05, 0x0d,                         //     USAGE_PAGE (Digitizers)      
    0x09, 0x30,                         //     USAGE (Tip Pressure)         
    0x26, 0xff, 0x00,                   //     LOGICAL_MAXIMUM (255)        
    0x81, 0x02,                         //     INPUT (Data,Var,Abs)         
    0x75, 0x08,                         //     REPORT_SIZE (8)              
    0x09, 0x3d,                         //     USAGE (X Tilt)               
    0x15, 0x81,                         //     LOGICAL_MINIMUM (-127)       
    0x25, 0x7f,                         //     LOGICAL_MAXIMUM (127)        
    0x81, 0x02,                         //     INPUT (Data,Var,Abs)         
    0x09, 0x3e,                         //     USAGE (Y Tilt)               
    0x15, 0x81,                         //     LOGICAL_MINIMUM (-127)       
    0x25, 0x7f,                         //     LOGICAL_MAXIMUM (127)        
    0x81, 0x02,                         //     INPUT (Data,Var,Abs)         
    0xc0,                               //   END_COLLECTION                 
    0xc0                                // END_COLLECTION

Karabiner-Elements endlessly getting virtual-hid-device-service-client - connect_failed

Did installation steps. After sudo ./build/Release/virtual-hid-device-service-client which produced:

connected
driver_loaded 1
driver_version_matched 1
virtual_hid_keyboard_ready 1
virtual_hid_pointing_ready 1

but never completed so I stopped it. Now when I run Karabiner-Elements the log shows an unending report of
[Info] [grabber] virtual-hid-device-service-client_ connect_failed: No such file or directory

I've installed this before and gotten it working but with the latest update on Big Sur 11.0 20A5395g K-E stopped working and I've been trying to get it working again. Frankly, I don't really understand all the Mac actions and configurations so finding my missteps would be very helpful.
Thanks

v1.22.0 pkg fails usage test

On Big Sur 11.2.3.

Steps to reproduce:

  1. Follow instructions in README to uninstall existing.

  2. Follow instructions in README to install 1.22.0.pkg, basically like this:

git clone https://github.com/pqrs-org/Karabiner-DriverKit-VirtualHIDDevice.git
cd Karabiner-DriverKit-VirtualHIDDevice
open dist/Karabiner-DriverKit-VirtualHIDDevice-1.22.0.pkg
/Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/MacOS/Karabiner-VirtualHIDDevice-Manager activate
  1. Follow instructions in Usage section to test, basically like this:
cd examples/virtual-hid-device-service-client
make
make run

Expected results: Test works
Actual results:

$ make run
sudo ./build/Release/virtual-hid-device-service-client
Password:
Press control+c to quit.
connect_failed asio.system:2
connect_failed asio.system:2
connect_failed asio.system:2
^Cconnect_failed asio.system:2

Have confirmed tests work with pkg 1.15.0 and checked out at tag v1.15.0.

SwiftShell fails to compile with Xcode 12 beta

Moving to Xcode 12 / Big Sur Beta, trying to see if Karabiner would build properly.

SwiftShell is causing a problem.

Karabiner-DriverKit-VirtualHIDDevice/src/build/SwiftShell.build/Release/SwiftShell.build/Objects-normal/x86_64/Stream.o -o /Users/sl/work20/Karabiner-DriverKit-VirtualHIDDevice/src/build/SwiftShell.build/Release/SwiftShell.build/Objects-normal/x86_64/String.o

  1. Apple Swift version 5.3 (swiftlang-1200.0.16.9 clang-1200.0.22.5)

  2. While evaluating request TypeCheckSourceFileRequest(source_file "/Users/sl/Library/Developer/Xcode/DerivedData/Karabiner-DriverKit-ExtensionManager-dqgqbitpaigwqvawiwdtskopzgxw/SourcePackages/checkouts/SwiftShell/Sources/SwiftShell/Stream/Stream.swift")

  3. While type-checking 'FileHandleStream' (at /Users/sl/Library/Developer/Xcode/DerivedData/Karabiner-DriverKit-ExtensionManager-dqgqbitpaigwqvawiwdtskopzgxw/SourcePackages/checkouts/SwiftShell/Sources/SwiftShell/Stream/Stream.swift:207:8)

  4. While type-checking protocol conformance to 'TextOutputStreamable' (in module 'Swift') for type 'FileHandleStream' (declared at [/Users/sl/Library/Developer/Xcode/DerivedData/Karabiner-DriverKit-ExtensionManager-dqgqbitpaigwqvawiwdtskopzgxw/SourcePackages/checkouts/SwiftShell/Sources/SwiftShell/Stream/Stream.swift:207:8 - line:215:1] RangeText="class FileHandleStream: ReadableStream, WritableStream {
    public let filehandle: FileHandle
    public var encoding: String.Encoding

    public init(_ filehandle: FileHandle, encoding: String.Encoding) {
    self.filehandle = filehandle
    self.encoding = encoding
    }
    ")
    0 swift 0x0000000108cb2f65 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
    1 swift 0x0000000108cb1f65 llvm::sys::RunSignalHandlers() + 85
    2 swift 0x0000000108cb351f SignalHandler(int) + 111
    3 libsystem_platform.dylib 0x00007fff69e845bd _sigtramp + 29
    4 libsystem_platform.dylib 000000000000000000 _sigtramp + 18446603338739333728
    5 swift 0x000000010556c69b swift::constraints::ConstraintSystem::simplifyRestrictedConstraint(swift::constraints::ConversionRestrictionKind, swift::Type, swift::Type, swift::constraints::ConstraintKind, swift::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::constraints::ConstraintLocatorBuilder) + 779
    6 swift 0x000000010555c3d0 swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::ConstraintKind, swift::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::constraints::ConstraintLocatorBuilder) + 14960
    7 swift 0x0000000105567535 swift::constraints::ConstraintSystem::repairFailures(swift::Type, swift::Type, swift::constraints::ConstraintKind, llvm::SmallVectorImplswift::constraints::RestrictionOrFix&, swift::constraints::ConstraintLocatorBuilder) + 12677
    8 swift 0x000000010555c365 swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::ConstraintKind, swift::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::constraints::ConstraintLocatorBuilder) + 14853
    9 swift 0x000000010555c789 swift::constraints::ConstraintSystem::matchTypes(swift::Type, swift::Type, swift::constraints::ConstraintKind, swift::OptionSet<swift::constraints::ConstraintSystem::TypeMatchFlags, unsigned int>, swift::constraints::ConstraintLocatorBuilder) + 15913
    10 swift 0x0000000105580f90 swift::constraints::ConstraintSystem::addConstraintImpl(swift::constraints::ConstraintKind, swift::Type, swift::Type, swift::constraints::ConstraintLocatorBuilder, bool) + 96
    11 swift 0x0000000105558162 swift::constraints::ConstraintSystem::addConstraint(swift::constraints::ConstraintKind, swift::Type, swift::Type, swift::constraints::ConstraintLocatorBuilder, bool) + 66
    12 swift 0x000000010578925d llvm::Optionalswift::RequirementMatch llvm::function_ref<llvm::Optionalswift::RequirementMatch (swift::Type, swift::Type)>::callback_fn<swift::matchWitness(llvm::DenseMap<std::__1::pair<swift::GenericSignatureImpl const*, swift::ClassDecl const*>, swift::RequirementEnvironment, llvm::DenseMapInfo<std::__1::pair<swift::GenericSignatureImpl const*, swift::ClassDecl const*> >, llvm::detail::DenseMapPair<std::__1::pair<swift::GenericSignatureImpl const*, swift::ClassDecl const*>, swift::RequirementEnvironment> >&, swift::ProtocolDecl*, swift::ProtocolConformance*, swift::DeclContext*, swift::ValueDecl*, swift::ValueDecl*)::$_1>(long, swift::Type, swift::Type) + 93
    13 swift 0x000000010576a6fa swift::matchWitness(swift::DeclContext*, swift::ValueDecl*, swift::ValueDecl*, llvm::function_ref<std::__1::tuple<llvm::Optionalswift::RequirementMatch, swift::Type, swift::Type> ()>, llvm::function_ref<llvm::Optionalswift::RequirementMatch (swift::Type, swift::Type)>, llvm::function_ref<swift::RequirementMatch (bool, llvm::ArrayRefswift::OptionalAdjustment)>) + 8778
    14 swift 0x000000010576c233 swift::matchWitness(llvm::DenseMap<std::__1::pair<swift::GenericSignatureImpl const*, swift::ClassDecl const*>, swift::RequirementEnvironment, llvm::DenseMapInfo<std::__1::pair<swift::GenericSignatureImpl const*, swift::ClassDecl const*> >, llvm::detail::DenseMapPair<std::__1::pair<swift::GenericSignatureImpl const*, swift::ClassDecl const*>, swift::RequirementEnvironment> >&, swift::ProtocolDecl*, swift::ProtocolConformance*, swift::DeclContext*, swift::ValueDecl*, swift::ValueDecl*) + 1187
    15 swift 0x000000010576cd82 swift::WitnessChecker::findBestWitness(swift::ValueDecl*, bool*, swift::NormalProtocolConformance*, llvm::SmallVectorImplswift::RequirementMatch&, unsigned int&, unsigned int&, bool&) + 946
    16 swift 0x0000000105777423 swift::ConformanceChecker::resolveWitnessViaLookup(swift::ValueDecl*) + 643
    17 swift 0x0000000105772305 swift::MultiConformanceChecker::checkIndividualConformance(swift::NormalProtocolConformance*, bool) + 14821
    18 swift 0x000000010576e3c3 swift::MultiConformanceChecker::checkAllConformances() + 147
    19 swift 0x000000010577df77 swift::TypeChecker::checkConformancesInContext(swift::DeclContext*, swift::IterableDeclContext*) + 8295
    20 swift 0x000000010572de5a (anonymous namespace)::DeclChecker::visitClassDecl(swift::ClassDecl*) + 8138
    21 swift 0x0000000105726323 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 2739
    22 swift 0x00000001057edc89 swift::TypeCheckSourceFileRequest::evaluate(swift::Evaluator&, swift::SourceFile*) const + 953
    23 swift 0x00000001057f09c9 llvm::Expectedswift::TypeCheckSourceFileRequest::OutputType swift::Evaluator::getResultUncachedswift::TypeCheckSourceFileRequest(swift::TypeCheckSourceFileRequest const&) + 953
    24 swift 0x00000001057ed744 swift::TypeCheckSourceFileRequest::OutputType swift::evaluateOrDefaultswift::TypeCheckSourceFileRequest(swift::Evaluator&, swift::TypeCheckSourceFileRequest, swift::TypeCheckSourceFileRequest::OutputType) + 164
    25 swift 0x00000001049710b8 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 7576
    26 swift 0x0000000104832ee1 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6849
    27 swift 0x00000001047b7a97 main + 1255
    28 libdyld.dylib 0x00007fff69c65c71 start + 1
    error: Segmentation fault: 11 (in target 'SwiftShell' from project 'SwiftShell')

:0: error: unable to execute command: Segmentation fault: 11
:0: error: compile command failed due to signal 11 (use -v to see invocation)
** BUILD FAILED **

The following build commands failed:
CompileSwift normal x86_64
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(2 failures)

Question: building without a Developer ID?

According to its readme, Karabiner-VirtualHIDDevice can be built without a code signature from apple. Will you ever publish a version of Karabiner-DriverKit-VirtualHIDDevice that can be built without a signature?

Minor issue with Readme if changing the org

If Step 3 in the Readme is followed "(Optional) Replace org.pqrs with your domain." you also need to modify ExtensionManager/ContentView.swift to have the correct driverIdentifier loaded.

[Compilation error] no type named 'path' in namespace 'std::filesystem'

File: https://github.com/pqrs-org/Karabiner-DriverKit-VirtualHIDDevice/blob/main/include/pqrs/karabiner/driverkit/virtual_hid_device_service/constants.hpp

#include <filesystem> solved this. I didn't open a PR because I am not sure if that's the correct thing to do.

This is not an urget issue like the one above, but, I am getting deprected warnings about kIOMasterPortDefault. To solve this, I guess one could do:

#ifdef __MAC_12_0
  #define __kIOMainPortDefault kIOMainPortDefault
#else
  #define __kIOMainPortDefault kIOMasterPortDefault
#endif

If you are fine with above changes (feel free to correct me), I can open a PR.

Karabiner-Elements puzzling behavior

I've been having difficulties with K-E since one of the recent releases of Big Sur beta versions. My modifications in karabiner.json are being modified somehow in real time. When I go through the sequence of uninstalling the virtualHIDDevice driver and then installing the beta update (version 13.1.0) my modifications for the Microsoft Sculpt Comfort Mouse work for maybe 10-15 minutes and then a new device is somehow added (a copy of the MS mouse definition) which has the manufacturer set as Apple and the grabber (or something) stops responding to my actual physical mouse defined as a MS mouse. I cannot tell how that phantom mouse declaration is added or if it is responsible for the subsequent loss of perception of my actual mouse but I'd like to know how (and why) this modification takes place outside my own definitions. Thanks for any suggestions.

Kmonad:

Hello Tekezo,

I am a user of the Kmonad project which is dependent on this project at its
core. I have encountered a problem that I do believe pertains/relates to this project
so I want to ask here for advice or help. I put the reference to my kmonad issue below
but the gist of the problem is described in the following sentence:

My problem

After having used kmonad for weeks, on a macbook pro with
macOS 10.15.7, all of a sudden my keyboard froze and after rebooting my
computer I am presented with an error telling me:

IOServiceGetMatchingService error
^Creset_virtual_hid_keyboard error: (ipc/send) invalid destination port

Is there something obvious that I could have done wrong in order to cause this
problem or does there exist somekind of tool for problem shooting this??

kmonad/kmonad#332

Regards,
// Molleweide

Feature request: Virtual joystick device

I would like to use my Xbox-360 wireless controller on my MacBook, however the wireless reciever doesn't work with MacOS, but it does work on Linux using xboxdrv. Since this driver runs in userspace on top of libusb, it should be quite easy for me to port it to MacOS, as long as there is a way to forward the events to the system. Hence the need for a virtual joystick device.

README instructions missing `brew install xcodegen`

For a "clean"† macOS, the Usage section on the README, step 4., will fail on make with the following error:

$ make
/usr/bin/python3 ../../scripts/update-version.py
xcodegen generate
make: xcodegen: No such file or directory
make: *** [all] Error 1

This can be fixed by running

brew install xcodegen

before the make. This should be added to the README.


† For purposes of reproducing this issue, one can run brew uninstall xcodegen to get a "clean" state.

Activation failed with error 9

Hi,
I compiled your v0.11.0 code and run the ext manager app. However, when clicking activate button, the ouput said “the operation couldn’t be completed. OSSystemExtensionErrorDomain error 9”
Not sure what’s wrong. Maybe because I dont have driverkit entitlement.
Just asking if you have any insight.

Add Homebrew cask

Thank you very much for making this driver available!
I am using it for the MacOS port of my project keymapper. So far it works very well.

Have you thought about adding a homebrew cask for this project, which could be made a shared dependency of Karabiner-Elements and other applications? I think this would prevent many issues with incompatible installations.

Thanks!

Installer will not run on 12.4

control-clicking on the pkg and selecting open gives this error:
The operation couldn't be completed.
(com.apple.installer.pagecontroller error -1.)

More than one virtual keyboard?

Is it possible to create more than one virutal keyboard? In other words, Is it possible to create unique virtual keyboard, each corresponding to a captured (physical) keyboard?

I have encountered a problem when using a single virutal keyboard for more than one keyboard.

To reproduce:

  1. Press a modifier key, e.g. shift, on a keyboard (keyboardA).
  2. Press a key, e.g. f, on another keyboard (keyboardB).
  3. This will produce F.
  4. However, now, subsequent presses on keyboardB will produce non-shifted letter (e.g. f), rather than shifted letter (e.g. F).
  5. But on keyboardA, the first keypress after #2 will produce a non-shifted letter, and subsequent keypresses on that keyboard will produce shifted letters.

tl;dr -- holding a modifier key on 1 keyboard, and pressing a key on another keyboard creates problem.

Details:

  1. Dext version: 1.15.0
  2. Uses report.keys.insert for all keys.
    • Does that create problems when used for modifier keys?
    • Anyway, I will try to use report.modifiers.insert instead to see if it solves the problem.
  3. Tried using a single socket, and unique socket per device.
    • Doesn't solve the problem.
  4. Code: https://github.com/kmonad/kmonad/blob/master/c_src/mac/dext.cpp

Virtual Keyboard not added

Hello, I installed the latest version of the driver 3.1.0 and activated it like mentioned in the README. The driver seem to be loaded and activated but I don't see the virtual keyboard. How should I trouble shoot this?

Thank you,

~/Downloads❯ systemextensionsctl list
1 extension(s)
--- com.apple.system_extension.driver_extension
enabled	active	teamID	bundleID (version)	name	[state]
*	*	G43BCU2T37	org.pqrs.Karabiner-DriverKit-VirtualHIDDevice (1.7.0/1.7.0)	org.pqrs.Karabiner-DriverKit-VirtualHIDDevice	[activated enabled]
~/Downloads❯ defaults read /Applications/.Karabiner-VirtualHIDDevice-Manager.app/Contents/Info.plist CFBundleVersion
3.1.0

https://imgur.com/wtiIfrp

Edit: Tried version 2.1.0 (with clean uninstall) and still have the same problem.

Possible to install multiple instances side-by-side?

I am trying to run two instances of the dext at the same time. My first idea was to install different versions side-by-side, but even different versions install files to the same locations and probably collide in other ways that I cannot see. Would it be possible for me to change elements of installation so that two instances can coexist on the same machine and run concurrently?

Quick question about entitlements

Very very nice project showing how to build project with DriverKit extension. Far better than USBApp!

One quick question, can you confirm that you must have the appropriate entitlements from Apple before you can successfully load the driver extension?

I have built the app, signed with my cert, and get "Invalid code signature or missing entitlements".

I do have the driverkit.transport.usb entitlement, but not the driverkit.family.hid and driverkit.transport.hid entitlements.

Thanks!

Constant crashes with EXC_BAD_ACCESS (SIGSEGV) in Karabiner Elements 13.0.0

I have constant crashes in the driver.

`Process: org.pqrs.Karabiner-DriverKit-VirtualHIDDevice [5942]
Path: /Library/SystemExtensions/*/org.pqrs.Karabiner-DriverKit-VirtualHIDDevice
Identifier: org.pqrs.Karabiner-DriverKit-VirtualHIDDevice
Version: 1.0.0 (1.0.0)
Code Type: X86-64 (Native)
Parent Process: launchd [1]
Responsible: org.pqrs.Karabiner-DriverKit-VirtualHIDDevice [5942]
User ID: 270

Date/Time: 2020-10-06 09:41:55.015 +0200
OS Version: Mac OS X 10.15.6 (19G73)
Report Version: 12
Anonymous UUID: D79F4525-BACA-A88F-A335-8620849066AA

Time Awake Since Boot: 2500 seconds

System Integrity Protection: disabled

Crashed Thread: 1 Dispatch queue: org_pqrs_Karabiner_DriverKit_VirtualHIDKeyboard-Default

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: EXC_I386_GPFLT
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [5942]

Application Specific Information:
dyld2 mode

Thread 0:
0 libsystem_kernel.dylib 0x0000000105d77302 __semwait_signal_nocancel + 10
1 libsystem_c.dylib 0x0000000105ca2678 nanosleep$NOCANCEL + 185
2 libsystem_c.dylib 0x0000000105cbf450 sleep$NOCANCEL + 41
3 libdispatch.dylib 0x0000000105bf77b0 _dispatch_queue_cleanup2 + 156
4 libsystem_pthread.dylib 0x0000000105e6d921 _pthread_tsd_cleanup + 164
5 libsystem_pthread.dylib 0x0000000105e67206 _pthread_exit + 70
6 libsystem_pthread.dylib 0x0000000105e68033 pthread_exit + 42
7 libdispatch.dylib 0x0000000105bf33a0 dispatch_main + 99
8 com.apple.DriverKit 0x0000000105a21bad DriverExecutableMain + 66
9 libdyld.dylib 0x0000000105c5ec01 start + 1

Thread 1 Crashed:: Dispatch queue: org_pqrs_Karabiner_DriverKit_VirtualHIDKeyboard-Default
0 org.pqrs.Karabiner-DriverKit-VirtualHIDDevice 0x0000000105a02653 org_pqrs_Karabiner_DriverKit_VirtualHIDKeyboard::setReport(IOMemoryDescriptor*, IOHIDReportType, unsigned int, unsigned int, OSAction*) + 87
1 com.apple.HIDDriverKit 0x0000000105a91ab8 IOHIDDevice::_ProcessReport_Impl(HIDReportCommandType, IOMemoryDescriptor*, IOHIDReportType, unsigned int, unsigned int, OSAction*) + 88
2 com.apple.HIDDriverKit 0x0000000105aa26b0 IOHIDDevice::_ProcessReport_Invoke(IORPC, OSMetaClassBase*, void ()(OSMetaClassBase, HIDReportCommandType, IOMemoryDescriptor*, IOHIDReportType, unsigned int, unsigned int, OSAction*)) + 142
3 com.apple.DriverKit 0x0000000105a21241 invocation function for block in OSMetaClassBase::Invoke(IORPC) + 117
4 com.apple.DriverKit 0x0000000105a20eb1 OSMetaClassBase::Invoke(IORPC) + 717
5 com.apple.DriverKit 0x0000000105a21739 Server(void*, mach_msg_header_t*, mach_msg_header_t*) + 584
6 com.apple.DriverKit 0x0000000105a22acd uiomachchannel(void*, dispatch_mach_reason_t, dispatch_mach_msg_s*, int) + 149
7 libdispatch.dylib 0x0000000105bfce55 _dispatch_mach_msg_invoke + 435
8 libdispatch.dylib 0x0000000105becf06 _dispatch_lane_serial_drain + 263
9 libdispatch.dylib 0x0000000105bfd9a8 _dispatch_mach_invoke + 481
10 libdispatch.dylib 0x0000000105becf06 _dispatch_lane_serial_drain + 263
11 libdispatch.dylib 0x0000000105beda1d _dispatch_lane_invoke + 414
12 libdispatch.dylib 0x0000000105beebba _dispatch_workloop_invoke + 1813
13 libdispatch.dylib 0x0000000105bf6fdf _dispatch_workloop_worker_thread + 596
14 libsystem_pthread.dylib 0x0000000105e68c0a _pthread_wqthread + 290
15 libsystem_pthread.dylib 0x0000000105e6e0cb start_wqthread + 15

Thread 2:
0 libsystem_pthread.dylib 0x0000000105e6e0bc start_wqthread + 0

Thread 3:
0 libsystem_kernel.dylib 0x0000000105d7758a __sigsuspend_nocancel + 10
1 libdispatch.dylib 0x0000000105bf7872 _dispatch_sigsuspend + 36
2 libdispatch.dylib 0x0000000105bf784e _dispatch_sig_thread + 55

Thread 1 crashed with X86 Thread State (64-bit):
rax: 0xaaaaaaaaaaaaaaaa rbx: 0x000070000fdebea8 rcx: 0xc35266e3aeb0007d rdx: 0x0000000000000000
rdi: 0x0000000000000000 rsi: 0x0000000000000000 rbp: 0x000070000fdebef0 rsp: 0x000070000fdebe90
r8: 0x0000000000000008 r9: 0x0000000000000000 r10: 0x000000000000000a r11: 0x0000000000000246
r12: 0x00000000e00002c7 r13: 0x0000000000000000 r14: 0x0000600000578058 r15: 0x0000000000000000
rip: 0x0000000105a02653 rfl: 0x0000000000010282 cr2: 0x00007fcf14700018

Logical CPU: 8
Error Code: 0x00000000
Trap Number: 13

Binary Images:
0x1059fe000 - 0x105a05fff +org.pqrs.Karabiner-DriverKit-VirtualHIDDevice (1.0.0 - 1.0.0) /Library/SystemExtensions/*/org.pqrs.Karabiner-DriverKit-VirtualHIDDevice
0x105a1e000 - 0x105a4bff7 com.apple.DriverKit (1.0 - ???) <450A6B3B-881A-3BB2-A57F-DDE9F8A2D01B> /System/DriverKit/System/Library/Frameworks/DriverKit.framework/DriverKit
0x105a8e000 - 0x105aaefff com.apple.HIDDriverKit (1.0 - 1) <189B7F0A-BE8C-3900-8B97-038A5ECBDD53> /System/DriverKit/System/Library/Frameworks/HIDDriverKit.framework/HIDDriverKit
0x105acb000 - 0x105adcff7 libc++.dylib (902.1) <1B680330-0CE7-309C-8745-40B0D01BA5C6> /System/DriverKit/usr/lib/libc++.dylib
0x105af5000 - 0x105af6ff7 libSystem.dylib (1281.100.1) <95F03C1C-CA96-3C7C-B573-A9208F8441D0> /System/DriverKit/usr/lib/libSystem.dylib
0x105b03000 - 0x105b0aff7 libcompiler_rt.dylib (101.2) /System/DriverKit/usr/lib/system/libcompiler_rt.dylib
0x105b1b000 - 0x105bbdfd7 libcorecrypto.dylib (866.140.1) <4672BE78-40B4-3FAE-9CB2-6F620EAEC208> /System/DriverKit/usr/lib/system/libcorecrypto.dylib
0x105be6000 - 0x105c28fff libdispatch.dylib (1173.100.2) <4DBEB483-1CD4-394E-84EB-4FA9E6ECFC67> /System/DriverKit/usr/lib/system/libdispatch.dylib
0x105c5e000 - 0x105c71ff7 libdyld.dylib (750.6) <803107D6-745C-366A-80C5-922C4072BF1C> /System/DriverKit/usr/lib/system/libdyld.dylib
0x105c85000 - 0x105c85fff libmacho.dylib (959.0.1) <95882E52-5C07-3C59-AB35-A97303344204> /System/DriverKit/usr/lib/system/libmacho.dylib
0x105c8d000 - 0x105c8dfff libsystem_blocks.dylib (74) <26482DA6-E097-3DF1-8288-542CB26A2917> /System/DriverKit/usr/lib/system/libsystem_blocks.dylib
0x105c9d000 - 0x105d22ff7 libsystem_c.dylib (1353.100.2) <36450845-2ABF-30A4-BDB0-8A93A85F1A4A> /System/DriverKit/usr/lib/system/libsystem_c.dylib
0x105d57000 - 0x105d86fff libsystem_kernel.dylib (6153.141.1) <470D9C8C-50AA-3423-91CB-2C850E0799B3> /System/DriverKit/usr/lib/system/libsystem_kernel.dylib
0x105da8000 - 0x105df9fef libsystem_m.dylib (3178) /System/DriverKit/usr/lib/system/libsystem_m.dylib
0x105e0f000 - 0x105e39fff libsystem_malloc.dylib (283.100.6) /System/DriverKit/usr/lib/system/libsystem_malloc.dylib
0x105e4f000 - 0x105e57ff7 libsystem_platform.dylib (220.100.1) /System/DriverKit/usr/lib/system/libsystem_platform.dylib
0x105e66000 - 0x105e71fff libsystem_pthread.dylib (416.100.3) /System/DriverKit/usr/lib/system/libsystem_pthread.dylib
0x105e85000 - 0x105e8afff libsystem_trace.dylib (1147.120) <1D096E7A-B37C-30E9-AB0E-157FDCDB5146> /System/DriverKit/usr/lib/system/libsystem_trace.dylib
0x105e98000 - 0x105eb0fff libc++abi.dylib (902) <1CE8C2A0-58D4-3C23-A9F2-968B0C3A2E31> /System/DriverKit/usr/lib/libc++abi.dylib
0x105ed1000 - 0x105edcff7 com.apple.USBDriverKit (1.0 - 1) <11F79371-19D5-3EF3-AB3D-5E0E3CFFAFFF> /System/DriverKit/System/Library/Frameworks/USBDriverKit.framework/USBDriverKit
0x1073d6000 - 0x107467f47 dyld (750.6) <34A11073-9E4C-38C3-9293-7D566ABAE8B6> /usr/lib/dyld

External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 3714
thread_create: 0
thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=5196K resident=0K(0%) swapped_out_or_unallocated=5196K(100%)
Writable regions: Total=534.0M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=534.0M(100%)

                            VIRTUAL   REGION 

REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
Kernel Alloc Once 8K 1
MALLOC 140.2M 14
MALLOC guard page 24K 4
MALLOC_NANO (reserved) 384.0M 1 reserved VM address space (unallocated)
STACK GUARD 56.0M 4
Stack 9752K 4
__DATA 424K 27
__DATA_CONST 216K 21
__DATA_DIRTY 12K 3
__LINKEDIT 1664K 22
__TEXT 3536K 21
shared memory 8K 2
=========== ======= =======
TOTAL 595.4M 124
TOTAL, minus reserved VM space 211.4M 124

System Profile:
Network Service: Ethernet, Ethernet, en0
Network Service: Wi-Fi, AirPort, en1
Boot Volume File System Type: apfs
PCI Card: Intel UHD Graphics 630 (Desktop 9 Series), Display controller, Built In
PCI Card: Intel Z390 USB 3.1 xHCI Host Controller, USB controller, Built In
PCI Card: Intel Z390 SATA Controller, SATA controller, Built In
PCI Card: Apple High Definition Audio Controller, Audio device, Built In
PCI Card: Intel Z390 SPI Controller, Serial bus controller, Built In
PCI Card: Intel I219V7 PCI Express Gigabit Ethernet, Ethernet controller, Built In
PCI Card: BCM4360 802.11ac Wireless Network Adapter, Network controller, Slot 4
PCI Card: Samsung 970 Evo NVMe SSD, Non-Volatile memory controller, PCIe M.2 Slot 1
Memory Module: BANK 0/ChannelA-DIMM0, 8 GB, DDR4, 3200 MHz, 8502, 3200 C16 Series
Memory Module: BANK 1/ChannelA-DIMM1, 8 GB, DDR4, 3200 MHz, 8502, 3200 C16 Series
Memory Module: BANK 2/ChannelB-DIMM0, 8 GB, DDR4, 3200 MHz, 8502, 3200 C16 Series
Memory Module: BANK 3/ChannelB-DIMM1, 8 GB, DDR4, 3200 MHz, 8502, 3200 C16 Series
USB Device: Ultra Fit
USB Device: Hub
USB Device: 4-Port USB 3.0 Hub
USB Device: 4-Port USB 3.0 Hub
USB Device: Logitech BRIO
USB Device: USB2.0 Hub
USB Device: BRCM20702 Hub
USB Device: Bluetooth USB Host Controller
USB Device: USB 2.0 Hub [MTT]
USB Device: farbwerk 360
USB Device: farbwerk 360
USB Device: VISION
USB Device: D5 NEXT
USB Device: aquaero
USB Device: USB2.0 Hub
USB Device: Hub
USB Device: Plantronics BT600
USB Device: Jabra Link 370
USB Device: Jabra Evolve 75
USB Device: Composite Device
USB Device: 4-Port USB 2.0 Hub
USB Device: RODE NT-USB
USB Device: Razer BlackWidow Tournament Edition Chroma
USB Device: 4-Port USB 2.0 Hub
USB Device: USB Receiver
USB Device: Stream Deck
USB Device: LUXAFOR FLAG
Serial ATA Device: Samsung SSD 850 EVO 250GB, 250,06 GB
Serial ATA Device: Samsung SSD 850 EVO 500GB, 500,11 GB
Serial ATA Device: ST2000LX001-1RG174, 2 TB
Serial ATA Device: CT2000MX500SSD1, 2 TB
Model: iMac19,1, BootROM 1037.120.79.0.0, 8 processors, 8-Core Intel Core i9, 3,6 GHz, 32 GB, SMC 2.46f12
Graphics: Radeon RX 5700 XT 50th Anniversary, Radeon RX 5700 XT 50th Anniversary, spdisplays_pcie_device, 8 GB
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x111), Broadcom BCM43xx 1.0 (7.77.111.1 AirPortDriverBrcmNIC-1615.1)
Bluetooth: Version 7.0.6f7, 3 services, 27 devices, 1 incoming serial ports
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.