dext | 🔍 A smart launcher Powered by JavaScript | BPM library
kandi X-RAY | dext Summary
kandi X-RAY | dext Summary
Dext is a JavaScript powered smart launcher. Built with JavaScript behind the influences of Alfred. Made compatible with Alfred workflows that is powered by node (see: alfy).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of dext
dext Key Features
dext Examples and Code Snippets
Community Discussions
Trending Discussions on dext
QUESTION
I'm new to the community and I have just started to learn how to code. So, what I was first trying to do is to change the installation path of the packages of Homebrew to my External Disk (Llyne DExt), but failed. So now I can't brew uninstall because I get this:
...ANSWER
Answered 2022-Mar-17 at 04:37Do you want to uninstall Brew? try this
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
QUESTION
I've been creating a virtual ethernet interface. I've opened asynchronous communication with a controlling application and every time there are new packets, the controlling app is notified and then asks for the packet data. The packet data is stored in a simple struct, with uint8_t[1600]
for the bytes, and uint32_t
for the length. The dext is able to populate this struct with dummy data every time a packet is available, with the dummy data visible on the controlling application. However, I'm struggling to fill it with the real packet data.
The IOUserNetworkPacket
provides metadata about a packet. It contains a packets timestamp, size, etc, but it doesn't seem to contain the packet's data. There are the GetDataOffset()
and GetMemorySegmentOffset()
methods which seem to return byte offsets for where the packet data is located in their memory buffer. My instinct tells me to add this offset to the pointer of wherever the packet data is stored. The problem is I have no idea where the packets are actually stored.
I know they are managed by the IOUserNetworkPacketBufferPool
, but I don't think that's where their memory is. There is the CopyMemoryDescriptor()
method which gives an IOMemoryDescriptor
of its contents. I tried using the descriptor to create an IOMemoryMap
, using it to call GetAddress()
. The pointers to all the mentioned objects lead to junk data.
I must be approaching this entirely wrong. If anyone knows how to access the packet data, or has any ideas, I would appreciate any help. Thanks.
Code snippet within IOUserClient::ExternalMethod
:
ANSWER
Answered 2022-Feb-08 at 07:47The problem was caused by an IOUserNetworkPacketBufferPool
bug. My bufferSize
was set to 1600 except this value was ignored and replaced with 2048. The IOUserNetworkPackets
acted as though the bufferSize
was 1600 and so they gave an invalid offset.
Creating the buffer pool and mapping it:
QUESTION
I have tried extending IOUserNetworkEthernet
and calling RegisterEthernetInterface()
. This works perfectly for one ethernet interface, though the driver crashes when RegisterEthernetInterface
is called a second time (doesn't return an error code). I have tried registering with separate queues.
Another approach was extending IOUserClient
instead, and calling IOService::Create
to create child IOUserNetworkEthernet instances. Everything about this approach works (the children appear within ioreg). However, once I call RegisterEthernetInterface
on just one of the children, macOS crashes.
How would I go about creating a dext with multiple ethernet interfaces? Have I been approaching it the right way?
Appreciate any help.
...ANSWER
Answered 2022-Jan-21 at 14:34I haven't yet implemented an ethernet dext myself, but based on my experience with using DriverKit for other types of drivers and knowing its design goals, I have an idea what the solution might be.
First off, let's clarify: you're implementing either a virtual ethernet device, or you're building a driver for hardware that unites multiple independent ports in one physical device. In the former case (I'm guessing this is what you're doing based on your IOUserClient
comment), your driver will be matching IOUserResources
and you create the ethernet driver instance when you receive the corresponding message from your user space component.
Now, DriverKit design: DriverKit is built around a goal of keeping the driver instance for each device in its own separate process. Sort of circling back to the microkernel idea. Specifically, this means that multiple devices that use the same driver will each create an independent instance of that driver in its own process. This very likely means that NetworkingDriverKit was never designed to support more than one instance of IOUserNetworkEthernet
, because they are seen as separate devices. Hence the crashes.
OK, what do we do about it? Use DriverKit the way it was intended. Put each virtual ethernet adapter in its own driver instance. This gets a bit tricky. I think this should work:
- Your dext has a "control" instance. This is the thing that matches
IOUserResources
. It's a simpleIOService
class which listens for the signal (presumablyIOUserClient
) to create or destroy a virtual ethernet device. When creating a virtual ethernet device, you need that to run in its own driver instance though. (For an actual device with multiple ports, this would match the USB/PCI device nub, manage bus communication with the device, and enumerate the ports.) - Instead of creating an instance of a
IOUserNetworkEthernet
subclass, create an instance of a "nub" class and attach it to your central control class instance. CallRegisterService()
in its startup code, so it's considered for IOKit matching. - Set up a second IOKit matching dictionary in your Info.plist, which matches your new "nub" object. Here, use your
IOUserNetworkEthernet
-derived class to "drive" the nub. Once the virtual ethernet device is ready to use, callRegisterEthernetInterface()
.
2 extra things to note:
- The virtual device will run in a separate process from the control object, so they can only communicate via DriverKit inter-process calls, i.e. user clients. Hopefully, they don't really need to communicate much though, and the control client can pass all the information required via properties on the nub. If you're implementing support for multi-port hardware, you probably won't be able to avoid this part though.
- Your user space component (app, daemon) will need to open a new communication channel with the virtual device, so you'll probably need to implement user client support there too.
I'm not sure how you'd go about shutting down an individual virtual ethernet device, you could try calling Terminate()
on either it or the nub it's matched on and see what happens.
QUESTION
How to memory-map a PCI Base Address Register (BAR) from a PCIDriverKit driver (DEXT) to a userspace application?
Memory-mapping from a driver extension to an application can be accomplished by implementing the IOUserClient::CopyClientMemoryForType in the user client subclass (on the driver side) and then calling IOConnectMapMemory64 (from the user-space application side). This has been very nicely and thoroughly explained in this related answer.
The only missing bit is getting an IOMemoryDescriptor corresponding to the desired PCI BAR in order to return it from the CopyClientMemoryForType
implementation.
Asked another way, given the following simplified code, what would be the implementation of imaginaryFunctionWhichReturnsTheBARBuffer
?
ANSWER
Answered 2022-Jan-16 at 17:01Turns out IOPCIDevice::_CopyDeviceMemoryWithIndex
was indeed the function needed to implement this (but the fact that it's private is still an inconvenient).
Bellow is some sample code showing how this could be implemented (the code uses MyDriver
for the driver class name and MyDriverUserClient
for the user client).
Relevant sections from MyDriver.cpp
implementation:
QUESTION
I am porting a MacOS PCI driver written with IOKit to the new PCIDriverKit framework.
I am able to perform DMA with a contiguous buffer allocated inside the dext (with IOBufferMemoryDescriptor::Create
).
But I would also like to perform DMA to and from a buffer allocated by an application.
What I exactly want to do is:
- Allocate an aligned buffer in the app (with e.g.
posix_memalign
) - Send the pointer to this buffer to the dext
- In the dext, retrieve the list of pages descriptors to be able to perform DMA without copy into (or from) this buffer.
In IOKit, we could use methods such IOMemoryDescriptor::withAddressRange
and IODMACommand::gen64IOVMSegments
to map and retrieve the scatter gather list but I cannot find any information on how to do this in a dext with the PCIDriverKit framework.
Can anybody help me on how to do that?
...ANSWER
Answered 2022-Jan-06 at 22:04It's not quite the same question as yours, but in my answer to it I go into some detail on memory descriptors in DriverKit extensions.
Basically, in DriverKit you can only access user space memory that was explicitly provided as a buffer; you can't interpret arbitrary data as pointers in the user process's address space and create memory descriptors for them.
The only way to create memory descriptors for user space buffers that I'm aware of is via "struct" arguments to IOUserClient
external methods, i.e. when the user process passes them to the IOConnectCallMethod*
family of functions as either an input or output "struct". If the buffer is larger than 4096 bytes, it'll show up in the dext as an IOMemoryDescriptor
, and you can perform the usual DMA operations with it.
Typically, you'll want to do this in combination with async external methods, which lets you implement sensible buffer lifetime semantics, but your dext can technically hold on to user space supplied memory descriptors past the return of a synchronous external method, or past the async completion of an asynchronous one.
QUESTION
kernel: DK: MyDriver-0x100000f45: provider entitlements check failed
kernel: DK: IOUserServer(com.MyDriver-0x100000f45)::exit(Entitlements check failed)
kernel: (com.MyDriver.dext) Kernel requested exit (Entitlements check failed)
...ANSWER
Answered 2021-Jul-11 at 19:39I don't have a 100% answer as to why it's going wrong in your case. To load a dext on an unmodified system, you definitely need the following when codesigning your dext:
- Sign with a 'Developer ID Application' certificate identity and be notarised, or signed with an 'Apple Developer' certificate
- Embedded code signing entitlements including the generic DriverKit entitlement, any family-specific entitlements, and entitlements regarding user client access if necessary.
- A provisioning profile from Apple which matches:
- The code signing entitlements you are embedding in the dext.
- The type and specific instance of the code signing identity you are using to sign the dext.
- The Application & Bundle ID of the dext.
- If using an Apple Developer signing identity, the hardware IDs of the Macs on which you will be testing the dext.
For local testing, you can try the following things to temporarily work around code signing issues:
- Disabling System Integrity Protection (SIP). For purposes of DriverKit extensions, this disables some codesigning checks.
- Disabling DriverKit-specific entitlements checks. This turns off checking for a lot of family-specific entitlements. To disable the checks, set flag
0x8000
in thedk
kernel boot argument, which is a bitfield. Note that unless you set flag0x1
, DriverKit will be entirely disabled. So usedk=0x8001
to disable DriverKit entitlement checks. - Disabling AMFI checks. AMFI will normally kill your process if you try to claim entitlements which need to be enabled in a provisioning profile. You can disable AMFI with the
amfi_get_out_of_my_way=1
kernel boot argument.
Obviously, you only have limited control over the provisioning profile, as the entitlements in it must be approved by Apple. (For this reason, if you're planning to ship your dext publicly, I generally recommend you try to work out what entitlements you might need before starting full development on the dext, and request them from Apple. The process can take months.) So while it would be interesting to know the exact minimum combination of workarounds required when you don't have these profiles, I haven't exhaustively tested this out yet. I realise this doesn't help much with getting your dext as close to shipping as possible while still waiting for Apple to grant missing entitlements. Hopefully one of these days I can systematically explore and document all of this.
QUESTION
I have a DriverKit extension that can match a usb audio device just fine, but if I leave the device plugged in during a reboot, the AppleUSBAudio
kernel extension matches it instead.
Unplugging and replugging load my dext instead.
Is this to be expected? Do all System Extensions have this shortcoming? How can I remedy this?
...ANSWER
Answered 2021-Apr-14 at 20:12On macOS 11, if one of Apple's kexts matches your device, and their driver is in the "boot" or "sys" collections (see man kmutil
), which it normally will be, then their driver will win matching against yours, even if yours has a higher probe score.
On macOS 10.15, it should depend on whether or not their kext is in the prelinked kernel/kext cache. Third party kexts can also be included here so it's a little more democratic at least. Dexts can't be in the kextcache though.
I've filed an Apple DTS TSI about this issue and they've acknowledged it as a bug. I strongly recommend you file it as a bug as well to increase chances of it being fixed.
You should be able to work around it in a rather ugly way by explicitly force resetting the device from a user space daemon if your driver didn't manage to grab it. This will cause it to be re-enumerated by the USB subsystem, and for I/O Kit matching to be repeated, at which point your dext hopefully manages to win!
QUESTION
Our request to get the entitlement com.apple.developer.driverkit.userclient-access
to access our Driverkit driver with bundle id com.example.driver
for the app with bundle id com.example.app
was processed but we are not sure that we got the correct entitlements. When we generate a new provisioning profile for the app and inspect it the entitlements in the profile with security cms -D -i
it says:
ANSWER
Answered 2021-Jan-13 at 21:03The com.apple.developer.driverkit.userclient-access
key should indeed be an array of strings with the bundle IDs listed. This is what I've got in the .entitlements file for the app in my "demo" DriverKit project which I use for prototyping things:
QUESTION
I am migrating a codeless KEXT to a codeless DEXT. I have watched the WWDC video and read much of the information on the Apple Developer site. The difficulty I am having is finding not what to do but how to get started. A nice tutorial with an example project would help.
In my codeless KEXT, for 4 separate devices I have IOKitPersonalities for IOUSBDevice and IOUSBInterface for each device. The KEXT allowed me to match my devices to my "driver" so the Apple HID driver wouldn't grab them. I wish to do the same or something similar in the codeless DEXT.
So far, I have created a DriverKit target (for a DriverKit.framework) called MyUsbDriver in an app and added a USBDriverKit.framework. That added a folder MyUsbDriver to my project with files MyUsbDriver.cpp, MyUsbDriver.iig, Info.plist and MyUsbDriver.entitlements. Here are my questions:
It looks like the default subclass of IOService is OK for USB - that is the same as the IOClass from the KEXT. Is that true?
Is IOUSBHostInterface in DEXT-world equivalent to IOUSBInterface in KEXT-world?
Is IOUSBHostDevice equivalent to IOUSBDevice?
Do I need to do anything to the .cpp or .iig for codeless DEXT? Isn't most of my work to be done in the plist and entitlements files?
Do I need the USBDriverKit.framework in my Frameworks and Libraries of MyUsbDriver target?
Where can I find a decent example of how to complete this migration?
Any help would be greatly appreciated.
Update:
Using the example and other links in the answer I was able to get something together. I did have a "Doh" moment: My initial test project type was Command Line Tool and I could never get the DEXT to embed. I almost just hand-edited the pbxproj file. However, in looking at the original example USBApp from Scott Knight, I realized the project type he was using was App, In hindsight, that makes sense but at the time was confounding.
Here is the info.plist I have so far to match on one of our deprecated devices:
...ANSWER
Answered 2020-Aug-06 at 07:55I was banging my head hard against getting the same thing to work. In the end I managed to get a working DEXT that disables the Apple HID driver for specific vendor ID/product ID combinations. We have obtained the DriverKit entitlement for our vendor ID.
- It looks like the default subclass of IOService is OK for USB - that is the same as the IOClass from the KEXT. Is that true?
This worked for me. I tried removing the .iig
and .cpp
files completely, but unlike KEXTs, it seems that there needs to be some code compiled in order for signing to work properly. So I ended up with just an empty subclass of IOService
.
- Is IOUSBHostInterface in DEXT-world equivalent to IOUSBInterface in KEXT-world?
I believe so. I used IOUSBHostInterface
and we had IOUSBInterface
in our KEXT.
- Is IOUSBHostDevice equivalent to IOUSBDevice?
I don't know, but I believe so.
- Do I need to do anything to the .cpp or .iig for codeless DEXT? Isn't most of my work to be done in the plist and entitlements files?
I did not need to change anything in the .cpp
and .iig
files. You might want to delete the os_log(OS_LOG_DEFAULT, "Hello World");
line in the .cpp
file before you release it. But while debugging, it was useful for me to tell whether the DEXT was actually loading or not. You can run log stream --source | grep 'HELLO'
in a terminal to look for the log.
- Do I need the USBDriverKit.framework in my Frameworks and Libraries of MyUsbDriver target?
My DEXT links against DriverKit.framework
. I don't know if it's needed or not.
- Where can I find a decent example of how to complete this migration?
Maybe these can help:
- https://github.com/stuartlynne/USBApp-updated
- Migrating from codeless KEXT to DEXT. Usb interfaces disappeared
- Performance issue after migrating from codeless KEXT to DEXT
During development of a DriverKit extension (dext), do the following:
Disable system integrity protection (SIP): https://apple.stackexchange.com/a/208481/21491. (Reboot in recovery mode, run
csrutil disable
). Remember to enable it again!Enable system extension development mode by running
systemextensionsctl developer on
Make sure you don't have your old codeless KEXT installed. (Delete it from
/Library/Extensions
and/or/System/Library/Extensions
. Make sure to reboot afterwards)
You might need a manual provisioning profile that contains the DriverKit entitlements. I think my problem was that I got the DriverKit entitlement on an enterprise developer team instead of a team for public development.
The app that loads the extension needs the "System Extension" entitlement, but does not need a manual provisining profile.
Be ware of a stupid bug in System Preferences. You need to consent to loading the dext every time it gets loaded. However, if the "Security & Privacy" pane is already open, it will not show the button to give the consent. You need to restart System Preferences for it to show up. I've been using the command
pkill -9 "System Preferences"; open /System/Library/PreferencePanes/Security.prefPane
from Terminal generously to workaround this.You can use
systemextensionsctl
to uninstall the dext or reset the system state. However, this does not actually change the driver matching, so you need to reboot. Generously. I used this Terminal command because I'm lazy:osascript -e 'tell app "System Events" to restart'
.You can use
ioreg
to check whether devices are being matched to the extension or not:ioreg -lirc IOUSBHostInterface
.The key to getting the extension to work is to set the
IOProviderClass
toIOUSBHostInterface
instead ofIOResources
in the Info.plist file. (For reference, the KEXT usesIOUSBInterface
which is one of the classes that Apple has deprecated)You might want to bump the version in
Info.plist
every time you make changes to your DEXT to make sure that you are actually using the correct one. (systemextensionsctl
will show the version it has loaded).
QUESTION
I built a codeless DEXT to replace a working codeless KEXT - Migrating a codeless KEXT to a codeless DEXT. I referenced a few sites and GitHub repositories to put it together and had help from other SO users.
I am running with SIP turned off, developer mode is on (systemextensionsctl developer on). I am following the advice outlined here https://github.com/knightsc/USBApp/issues/1 for signing the app and dext.
When I run the app it is embedded in and request activation for the extension, that function seems to succeed. However, I then get a call to -
...ANSWER
Answered 2020-Aug-18 at 14:12After a week of vacation not thinking about work at all, I figured this problem out! I re-read information in How to set `com.apple.developer.driverkit.transport.usb` entitlement? and realized my entitlements file was not correctly formatted.
Here is my old file, created in the editor in Xcode:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install dext
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page