Re: Loading KEXT dynamicaly for a USB MassStorage Drive
Re: Loading KEXT dynamicaly for a USB MassStorage Drive
- Subject: Re: Loading KEXT dynamicaly for a USB MassStorage Drive
- From: "Herb Petschauer" <email@hidden>
- Date: Thu, 10 Aug 2006 10:13:17 -0700
Issues about whether this is the right thing to do or not aside :-)
USB Prober.app prompts you to install Klog.kext if Klog.kext isn't running [in the USB Logger Tab]. I believe that the source for USB Prober is in Darwin (probably the IOUSBFamily project) so you can see what it does.
[FWIW, PPC/IOUSBFamily-228.4.0/USBProberV2/USBLoggerController.m, - (BOOL)installKLogKext]
Cheers,
-H.
On 10/08/06, Michael Welch <
email@hidden> wrote:
I'm not sure of the API for loading kexts (I'd imagine
there is one, somewhere), but I've always just used fork/exec.
Something along the lines of:
int
load_kext(const char *path_to_kext) {
pid_t pid;
int status;
if((pid = fork()) == 0) {
status =
execl("/sbin/kextload", "/sbin/kextload", path_to_kext, 0);
exit(status);
}
if(waitpid(pid, &status, 0) == pid
&& WIFEXITED(status)) {
return
WEXITSTATUS(status);
}
return -1;
}
The downside is that kextload must be run by root.
- Mike
Hi All,
I am
working on to load\unload the KEXT dynamically from my application.
The
current scenario is like this,
1) I have
a KEXT file which has the IOKitPersonalities matching my USB device.
2) After copying this driver with the ROOT/WHEEL rights and restarting the
system the KEXT is loaded for my device.
3) My application is able to communicate with this KEXT to send commands to the
device. The aim of the application is to pass the scsi commands to the device.
I want to
eliminate the step 2. Ie.. My KEXT should not be loaded each time my machine
restarts. Instead when the application starts it should load the KEXT which is
used to issue the commands to my USB device.
Is there
any API that I can use to do this dynamically? Please help me with a sample or
link.
Regards,
V.Rajagovarthanan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden