darwin-drivers Mailing List http://lists.apple.com/archives/darwin-drivers/2009/Nov/index.html darwin-drivers Mailing List Mon, 23 Nov 2009 16:00:00 +0000 publishing information to the user space. http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00044.html Reply to list

Hello,

I have a kernel module package to port from linux which consists of a
single "service" module, an unknown number of separate plugin modules
and a user space access library.
All plugins have an id number and a name tag and tell this to the
service when they register. [...]
]]>
Re: Driver matching issue http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00043.html Reply to list
on 11/19/09 12:05 AM, email@hidden at
email@hidden wrote:

[...]

you are more likely to get an answer if you ask the usb list, not this one.
(email@hidden)

Stuart



 
]]>
Re: Driver matching issue http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00042.html Reply to list
If someone had something to say, they would have responded to your first email.

Stop spamming the list.
 
]]>
Driver matching issue http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00041.html Reply to list

Hi, 
   I had writen a USB driver used IOHIDDevice for father class,and IOProviderClass =
IOUSBInterface. However,when I loaded the driver using kextload
***.kext,there were some issues in the system.log as follow: 
   1, IOUSBInterface: family specific  Matching fails. [...]
]]>
help http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00040.html Reply to list

Hello, 
    I am writing a driver for a USB HID mouse.Should I inherited
from IOHIDDevice or IOUSBHIDDriver? My info.plist
file's content as follows:   

 <?xml
version="1.0" encoding="UTF-8"?>   

 <!DOCTYPE plist
PUBLIC "-//Apple//DTD PLIST 1.0//EN"

[...]

                    

[...] [...]
]]>
USB Mouse Driver http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00039.html Reply to list

Hello,     I am writing a driver for a USB HID mouse.Should I inherited from IOHIDDevice or IOUSBHIDDriver? My info.plist file's content as follows: 

 <?xml version="1.0"

[...]

<!DOCTYPE plist PUBLIC
"-//Apple//DTD PLIST 1.0//EN"

[...]

<plist version="1.0">

[...] [...]
]]>
Re: oops: Solution: Unloading network drivers from CLI http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00038.html Reply to list

So far I have had 100% reliability, provided my kext didn't panic the system anyway ;-).    The two Apple dude's who commented on the original thread identified the issue, that after an 'ifconfig .* up' and then 'ipconfig .* NONE'  the protocol no longer drops its reference. [...]
]]>
Re: oops: Solution: Unloading network drivers from CLI http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00037.html Reply to list

Hi,    Is this required / more reliable? I remember being able to unload/reload development driver by using this beforehand:     sudo ifconfig en1 down  sudo ipconfig set en1 NONE 
    Although it was not always successful (some issue with configd failing randomly).     Regards. [...]
]]>
Re: IOExternalMethodArguments.structure{In,Out}putDescriptor http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00036.html Reply to list

[...]

You're telling me... this stuff changed in 10.5, and it *still* isn't 
documented, two years later. 

 -Ryan  
 --
            Ryan Hankins      Software Engineer
Small Tree Communications      www.small-tree.com
      email@hidden      +1 651 209-6509 x303   [...]
]]>
Re: IOExternalMethodArguments.structure{In,Out}putDescriptor http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00035.html Reply to list

[...]

Ok, understood. If you know all that, it suddendly makes sense :)

I would have expected that for the async methods, the outputStruct is
part of the backing data structure and is retained until the async call
returns using sendAsyncResult().

[...] [...]
]]>
Re: IOMemoryDescriptor wrapper http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00034.html Reply to list

Jim,     You're taking a class that moves with the kernel from two releases back... regardless of whether this is the source of your problem, that's not a great idea.      = Mike    On Nov 10, 2009, at 11:00 AM, Jim O'Connor wrote:   I took the multi-memory descriptor code from 10.4. [...]
]]>
Re: IOExternalMethodArguments.structure{In,Out}putDescriptor http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00033.html Reply to list
[...]

The point of confusion is that the Async API and the Synch APIs are exactly the same!  That is they output buffers are only used when returning from the kernel, in the case of synchronous data this is after the IO obviously.  The Async case though returns before the I/O so the output data is less useful.  Although the output data is less useful in the async case, it isn't useless.

[...]

It's not very nice anyway.

[...]

Just pass the address and size in in a pair of scalar data fields, however if you really want to get sophisticated you may want to copy in a scatter/gather list in the struct data?

Cheers

Godfrey

 
]]>
Re: IOExternalMethodArguments.structure{In,Out}putDescriptor http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00032.html Reply to list

Hi Godfrey,

On Wed, Nov 11, 2009 at 10:20:17AM +1100, Godfrey van der Linden wrote:

[...]

What is there for then? Why do I pass in a pointer if it can't be used?
For outbound (from userspace) data, there is the inputStruct, which
works fine. I'm confused more and more about this API.

[...] [...]
]]>
Re: IOExternalMethodArguments.structure{In,Out}putDescriptor http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00031.html Reply to list

I'm sorry the news is not good.

If I read the code correctly, the output structure for async messages is what is returned when the IOConnectCallAsync... method returns from the kernel! Even the output memory descriptor is released on the return path. [...]
]]>
Re: IOMemoryDescriptor wrapper http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00030.html Reply to list
If you haven't already checked it out, see the ApplePCI sample.  It 
shows how to use the different APIs from a single kext depending on 
what you're targeting. 
http://developer.apple.com/mac/library/samplecode/AppleSamplePCI/index.html 

Also, if your hardware happens to only support 32-bit DMA, AND it 
allocates its own DMA buffers, you can simplify things somewhat by 
just using IOBufferMemoryDescriptor::inTaskWithPhysicalAddress() on 
the Intel side.  See these relevant messages: 

 http://lists.apple.com/archives/Darwin-drivers/2007/May/msg00049.html
http://lists.apple.com/archives/darwin-drivers/2006/Oct/msg00008.html  
 Jim  
At 10:00 AM -0900 11/10/09, Jim O'Connor wrote:
I took the multi-memory descriptor code from 10.4.11, it does VERY 
little, and just substituted my my minimal functionality for it's 
larger functionality. You are right, that it seems that my addr64_t 
getPhysicalSegment64 should be getting called, and not my 
IOPhysicalAddress getPhysicalSegment. Since IOPhysicalAddress is 
UInt32 on 32 bit Snow Leopard this seems bound to fail. 


 On Nov 10, 2009, at 9:22 AM, Michael Werner wrote:

[...]
]]>
Re: IOMemoryDescriptor wrapper http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00029.html Reply to list

I took the multi-memory descriptor code from 10.4.11, it does VERY  
little, and just substituted my my minimal functionality for it's  
larger functionality. You are right, that it seems that my addr64_t  
getPhysicalSegment64 should be getting called, and not my   [...]
]]>
Re: IOMemoryDescriptor wrapper http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00028.html Reply to list

I would have thought on Leopard/32-bit Snow Leopard you would use getPhysicalSegment64() since you may not know how much memory will
be installed and then on 64-bit Snow Leopard you would use the new API getPhysicalSegment(x, y, z) since getPhysicalSegment64 is deprecated. [...]
]]>
Re: IOMemoryDescriptor wrapper http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00027.html Reply to list
IODMACommand is almost always the "right" thing to do if you are maintaining state about the relationship between a driver and some memory.  It can be less ideal if you're not sure about your consumer, though.      = Mike    On Nov 10, 2009, at 10:04 AM, Ryan Hankins wrote:   For what it's worth, we (as in, same company, different developer) had this same problem, though I don't remember exactly why.  We had to move to IODMACommand...  -Ryan > quoted text

[...]

      
]]>
Re: IOMemoryDescriptor wrapper http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00026.html Reply to list

For what it's worth, we (as in, same company, different developer) had 
this same problem, though I don't remember exactly why. 

 We had to move to IODMACommand...  
-Ryan
 Fairly certain. I'll run through it again, though.  
 On Nov 9, 2009, at 10:52 PM, Michael Smith wrote:   [...]
]]>
Re: IOMemoryDescriptor wrapper http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00025.html Reply to list

Fairly certain. I'll run through it again, though.      On Nov 9, 2009, at 10:52 PM, Michael Smith wrote:       How much physical memory does your system have?     Are you sure you're implementing *all* of the methods?      = Mike    On Nov 9, 2009, at 11:31 PM, Jim O'Connor wrote:  > quoted text [...]
]]>
Re: IOExternalMethodArguments.structure{In,Out}putDescriptor http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00024.html Reply to list

[...]

Point taken. However, I still can't figure out how the structureOutput
pointer is used correctly. The part in userspace looks like this
(simplified):

  io_async_ref64_t asyncRef;
  unsigned char *buf;
  size_t size = 100;
  buf = malloc(size);

  asyncRef[kIOAsyncCalloutFuncIndex] [...]
]]>
IOMemoryDescriptor wrapper http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00023.html Reply to list

I am wrapping an IOBufferMemoryDescriptor by composition, linking  
against the 10.4 SDK. My class is VERY simple. Everything is a pass  
through to the inner memory descriptor, except that on creation and  
free I take some notes. 

This works just fine on Tiger and Leopard. [...]
]]>
oops: Solution: Unloading network drivers from CLI http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00022.html Reply to list
[...]

ifclient() { sudo ifconfig en2 inet 192.168.1.2  netmask  
0xffffff00 $@; } 

 Sorry  
 Godfrey  
 On 2009-11-10, at 2:32 PM, Godfrey van der Linden wrote:

[...]
]]>
Solution: Unloading network drivers from CLI http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00021.html Reply to list

So the problem was that I couldn't load and unload my development  
network driver.  With Josh's and another's help I have found the magic  
incantations for successfully unloading. 

 For you network developers out there  
 Cheers  
 Godfrey  
 #in your bashrc add   [...]
]]>
Re: IOExternalMethodArguments.structure{In,Out}putDescriptor http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00020.html Reply to list

On Nov 7, 2009, at 6:11 AM, Daniel Mack wrote:   On Fri, Nov 06, 2009 at 11:06:45AM -0800, Michael Smith wrote: > quoted text

[...]

I wouldn't make that assumption; better to handle both cases.  > quoted text
    No.  I explained why the two paths exist above. [...]
]]>
Re: IOExternalMethodArguments.structure{In,Out}putDescriptor http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00019.html Reply to list

[...]

Ah, ok. That explains it. I'm just sending in some 100 Bytes, and I
assume everything smaller than one page is not wrapped?

What puzzles me is the question _why_ that is: I need to create an
IOMemoryDescriptor anyway to write to that piece of memory, right? [...]
]]>
Re: IOExternalMethodArguments.structure{In,Out}putDescriptor http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00018.html Reply to list
On Nov 6, 2009, at 11:00 AM, Daniel Mack wrote:   I'm trying to get my head around how the structureOutputDescriptor and structureInputDescriptor parameters in struct IOExternalMethodArguments are supposed to work. In my IOUserClient::externalMethod() method callback, they're always NULL, and calling the superclass doesn't help either. I also tried the indirection via IOExternalMethodAction, but the MemoryDescriptors won't get initialized.  > quoted text
     How are you calling the userspace methods?     If your structure is "large" where "large" is not clearly defined, the kernel may decide that you probably don't want the whole thing copied, so it will give you an IOMemoryDescriptor that wraps your structure instead.  If you need arbitrary access you can map it, or if you want to cherry-pick fields out of it, use readBytes/WriteBytes.     HTH.      = Mike     
     --  True terror is to wake up one morning and discover that your high school class is running the country. -- Kurt Vonnegut             


      
]]>
IOExternalMethodArguments.structure{In,Out}putDescriptor http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00017.html Reply to list

Hi,

I'm trying to get my head around how the structureOutputDescriptor and
structureInputDescriptor parameters in struct IOExternalMethodArguments
are supposed to work. In my IOUserClient::externalMethod() method
callback, they're always NULL, and calling the superclass doesn't help
either. [...]
]]>
RE: IOStorage filters in 10.6 http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00016.html Reply to list

Thanks.  That explains everything I need to know. 
  
  
Tony   

CC: email@hidden From: email@hidden Subject: Re: IOStorage filters in 10.6 Date: Thu, 5 Nov 2009 18:36:48 -0800 To: email@hidden  Hey Tony,

 10.5 supports both the old interfaces and the new interfaces. [...]
]]>
Re: IOStorage filters in 10.6 http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00015.html Reply to list
Hey Tony,    10.5 supports both the old interfaces and the new interfaces.  You need only subclass one set.  We are able to route any invocation of the old interfaces over to your new implementation transparently.     You have to save a copy of the IOStorageAttributes and IOStorageCompletion if you wish to keep the I/O.  This was true of IOStorageCompletion in the old interfaces as well, but it was a bit more obvious without reading the documentation given that IOStorageCompletion was passed to you by value.     We do not have sample code to illustrate the new interfaces yet.  The new interfaces are documented in HeaderDoc nonetheless.     Dan     Le 2009-11-05 à 11:18, Tony Wong a écrit :   
I just want to make sure I understand this. 
  
Are you saying that 10.5 supports 2 read/write interface? 
  
The legacy one  
read(IOService *, Uint64, IOMemoryDescriptor *, IOSTorageCompletion) 
  
and the new one read(...., IOStorageAttributes *,  IOStorageCompletion *) 
  
And the kernel will use the interface that is defined in the driver? 
  
Now back to one of my original questions: 
  
If the customer has already installed the driver using the legacy interface 
and then he upgrades to 10.6, will the driver fails to load because the 
required interface is not defined or it will cause panic? 
  
I also have a question on the last 2 pointer parameters.  It seems that 
I have to make a copy of them if my driver does not dispatch the 
request to the lower level module in the some context.  Is that correct? 
I just used the pointer initially and I got panic as soon as there is IO. 
  
I did look around for sample code that uses IOStorage class but they 
are too old!  Where can I find sample code for snow leopard or there is none yet? 
  
I think I understand the 32 bit v.s. 64 bit. issue.  I am more confused about 
the new interface and the backward compatibility. 
  
Thanks very much.  
  
  
Tony 

CC: email@hidden From: email@hidden Subject: Re: IOStorage filters in 10.6 Date: Thu, 5 Nov 2009 09:51:06 -0800 To: email@hidden  Hey Tony,

 You can switch to the new interfaces safely.  We support it on both 10.5 and 10.6.  You need not special case 32-bit from 64-bit. 

 Dan 


 Le 2009-11-05 à 01:59, Tony Wong a écrit :  

 No.  Our product does not support 10.6 yet but we are in the process of porting the driver to 64 bit 10.6.   We actually thought it would work in 32 bit snow leopard but it does not seem possible.   Our driver does not use any 64 bit data types and we thought a simple recompilation would suffice but NO, thanks to the new interface.   We have not tried the upgrade from 10.5 to 10.6 with the old 10.5 drivers because our primary interest is 64 bit 10.6 and we know the 32 bit driver will not work.  I would like to get quick answer from you folks so we can save some time.    Thanks.   Tony Wong    

Subject: Re: IOStorage filters in 10.6 From: email@hidden Date: Thu, 5 Nov 2009 01:16:56 -0800 CC: email@hidden To: email@hidden  Tony, 

 Have you tried it yet? 

  = Mike 


 On Nov 5, 2009, at 12:46 AM, Tony Wong wrote:

[...]
]]>
RE: IOStorage filters in 10.6 http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00014.html Reply to list

No finger pointing here.  I just want to understand what is going on. 
  
Your first question : use 10.5 interface in 10.6 environment. 
  
Well my driver is using the interface  
read(...., IOMemoryDescriptor, IOStorageCompletion) because that is what I learned  [...]
]]>
Re: Can I export multiple user client objects on my kext? http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00013.html Reply to list

Hi Mike,     That was going to be my next question, but I see that I can do everything I need with the existing UserClient class.     Thanks,  Jim    On Nov 4, 2009, at 8:36 PM, Michael Smith wrote:      On Nov 3, 2009, at 11:12 AM, Jim O'Connor wrote:  > quoted text [...]
]]>
RE: IOStorage filters in 10.6 http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00012.html Reply to list

I just want to make sure I understand this. 
  
Are you saying that 10.5 supports 2 read/write interface? 
  
The legacy one  
read(IOService *, Uint64, IOMemoryDescriptor *, IOSTorageCompletion) 
  
and the new one read(...., IOStorageAttributes *,  IOStorageCompletion *) 
   [...]
]]>
Re: IOStorage filters in 10.6 http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00011.html Reply to list

Tony,     The IOStorageFamily team does a very meticulous job when it comes to situations like this; whilst I don't want to just automatically point the finger I'd be very surprised if you weren't able to do at least one of the following:      - use the 10.5 method in the 10. [...]
]]>
Re: IOStorage filters in 10.6 http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00010.html Reply to list

Hey Tony,    You can switch to the new interfaces safely.  We support it on both 10.5 and 10.6.  You need not special case 32-bit from 64-bit.     Dan     Le 2009-11-05 à 01:59, Tony Wong a écrit :   
No.  Our product does not support 10.6 yet but we are in the process  [...]
]]>
Re: IOStorage filters in 10.6 http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00009.html Reply to list

Hi Tony,

On Thu, Nov 5, 2009 at 8:59 PM, Tony Wong

[...]

You can build a universal Kext that works on all architectures. You
need to use #ifdef's for the 64 bit stuff. You'll have to use the 10.6
SDK for 64 bit (obviously), and the 10.5 SDK for 32 bit stuff. [...]
]]>
RE: IOStorage filters in 10.6 http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00008.html Reply to list

No.  Our product does not support 10.6 yet but we are in the process 
of porting the driver to 64 bit 10.6.   We actually thought it would work in 
32 bit snow leopard but it does not seem possible. 
  
Our driver does not use any 64 bit data types and we thought a simple  [...]
]]>
Re: IOStorage filters in 10.6 http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00007.html Reply to list

Tony,    Have you tried it yet?      = Mike     On Nov 5, 2009, at 12:46 AM, Tony Wong wrote:  > quoted text

    --  Excellence in any department can be attained only by the labor of a lifetime; it is not to be purchased at a lesser price -- Samuel Johnson              

 [...]
]]>
IOStorage filters in 10.6 http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00006.html Reply to list

I just found out that the read/write interface for the IOStorage class is 
not compatible in 10.6.  There is a new attr argument and the completion 
object is not passed as a pointer. 
  
It is trivial to port it BUT 
  
if the customer upgrades from 10.5 to 10. [...]
]]>
Re: Can I export multiple user client objects on my kext? http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00005.html Reply to list
On Nov 3, 2009, at 11:12 AM, Jim O'Connor wrote:  > quoted text
     Jim,     How would you expect I/O Kit to decide which class to instantiate?     As long as you have some way of differentiating between different client types, it's not hard to use a different method table to dispatch client requests; you don't need multiple client class types for this.      = Mike   
     --  True terror is to wake up one morning and discover that your high school class is running the country. -- Kurt Vonnegut             


      
]]>
Device matched but not loaded in Snow Leopard 64 bit mode http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00004.html Reply to list

Thanks to all the list for replies on my plist errors.     I have redone the personality, and think I have it fixed up from what I inherited. I am now matching with a score of 100000, but my driver still does not be called ( init function ).      Here is the new plist and a snip from USBProber. [...]
]]>
Re: Can I export multiple user client objects on my kext? http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00003.html Reply to list

G'day, Jim.  
As Chris said the default implementation of newUserClient isn't real  
smart.  If you want multiple interfaces automatically you could  
publish multiple nubs which share a single open-exclusive.  But it  
isn't really worth the effort, overriding newUserClient is a better bet. [...]
]]>
Re: Can I export multiple user client objects on my kext? http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00002.html Reply to list

Jim --     > quoted text
     I don't think so. I believe IOKit will only look for one class name to use. However, you can override newUserClient() and use the 'type' parameter to instantiate different classes.     -- Chris       
 ------------------ 
 6 Infinite Loop 
 M/S 306-2MS  [...]
]]>
Can I export multiple user client objects on my kext? http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00001.html Reply to list
If I put an array in my info.plist for IOUserClientClass can I export  
multiple user client objects so that I can have different interfaces  
on my kext to support older or different word size interfaces in this  
way? 

  Thanks,
Jim
]]>
Re: Universal driver for 10.4/10.5/10.6 and 64 bit http://lists.apple.com/archives/darwin-drivers/2009/Nov/msg00000.html Reply to list
Your personality needs to be under a top-level "IOKitPersonalities" property key.

Nik


On Oct 28, 2009, at 12:12 , Richard Smith wrote:

[...]
]]>