WWDC2000 Session 204
Transcript
Kind: captions
Language: en
gentlemen please welcome USB technology
manager Craig Keithley good afternoon
everybody thank you for coming now is a
very important time for us obviously
we're emphasizing Mac OS 10 and as part
of that we'll be talking about some of
the mac OS 10 features for USB I'm also
going to do an overview of Mac OS 9 to
give you an insight into what automatic
what standard USB drivers we have built
into the OS and to give you an overview
of what that architecture looks like
that's mostly meant as a refresher
because we are moving to 10 the other
thing too that I decided Monday night as
we committed to making the announcement
about allowed an installer maker
supporting us be software locator as I
cut out my five slides that I've been
presenting for the last couple of years
about what's inside a USB device figured
by now you already know that what you
want to know is how to make us be
software located works so we'll have
some presentation on that and at the end
we will go into doing driver development
on Mac OS 10 there is some difference in
USD under 9 and USB under 10 it's the
api's are slightly different the
structure is slightly different but I
think you'll see that it's a vast
improvement over what we've had in
driver architectures in the past 10 with
I oak it is a great leap forward I'll
also talk to you about our
recommendations that we make to
developers when they come in and they
asked us how should we create USB
devices for the Macintosh and those
recommendations by and large apply to
both mac OS 9 and Mac OS 10 so let me
talk about what we've done in Mac OS 9
i'll go over what's new i'll talk about
the standard drivers and i'll give you
an overview of the architecture so
what's new in 904 well not a lot we've
been fine-tuning performance we've been
addressing some issues the notable
improvements new features in Mac OS 9 04
and with the just released two day ago
multimedia updates are good USB
audio input works very well and we also
are pleased to announce that we've built
into mac OS 9 us be controlled UPS's so
all those that you've seen in the press
release is about having USB interfaces
not only do we have a USB driver we also
have added functionality into our power
manager to support UPS is automatically
it looks like a battery device it's very
cool and it's a great addition so what's
the specifics about the audio driver
well if you haven't been working with us
the audio I can tell you quite simply it
supports multiple frequencies multiple
sampling we use PCM format which is a
particular way of representing the data
in the data stream we support both
stereo output stereo input and
monophonic input we don't today support
monophonic output we don't support
vendor unique implementations for us the
audio devices if you're going to do a
USB audio device follow the USB
specification and you'll hear me say
that a couple of times a day that's our
number one recommendation if you're
going to do a USB device and you want it
to be supported by Apple's drivers
please absolutely follow the USB spec
for that class of device that's the best
way to get plugin site functionality on
the macintosh with power supplies the
major change aside from the USB driver
is a new power manager and this is in
904 it's what we it's in the new world
base Macintoshes its power manager 2
point 0 and power manager 2 point 0
which is only on the imac ibook power
mac powerbook families supports UPS is
built in this will allow you to connect
any UPS that conforms to that spec
another one of those great
recommendations follow the USD class
specifications will automatically work
we also exported an epi and this allows
third parties that want to do upss
vendor-specific control panels
monitoring of specific features that
aren't supported by off changing the
threshold see we have some specific
thresholds when I hits fifty percent of
battery capacity put up a warning dialog
when it reaches I think ten or twenty
percent we do a graceful shutdown you
may want to do a lot more than that and
you can do that by you
these AP is that we've exported it'll
make for really great products and
there's a new product announcements in
recent days I saw a press release cannot
from atc yesterday that announced that
they're supporting our new architecture
in mac OS 9 04 and using this new youth
USB standard to control their ups and
they added extra software and they use
our api to add extra functionality the
by the way the USB UPS stuff as part of
the USB DGK so you can go take a look at
that you can see how to expand upon the
basic features that that we have so
what's in Mac OS 9 well hid devices
keyboards lights gaming UPS is amazingly
enough UPS's are actually a hid device
mass storage except for CD in tapes we
support a wide range of USB mass storage
devices automatically we follow us
respect plug it in our driver loads and
recognizes and supports it we support
vdot 90 be 25 per roughly Hayes
compatible modems built-in support and
Mac OS you can just build your modem
comply with the spec plug it in and it
works audio is I've already mentioned we
have audio input and output we both
support stereo and mono phonic devices
and printing we've had for a long while
and this has actually turned out to be
pretty powerful both for people who are
printing the PostScript printers and who
just use our low-level printer driver
with their own shooter extension to talk
directly to the printer we supply that
you don't need to write a low-level
driver if your device complies with the
USB class specification for printing so
we've added with the desktop printing
utility the ability to print directly to
USB connected postscript printers very
nice feature and people who are doing
non postscript printers can still use
our class driver to talk to the printer
so they just need to write a chooser
extension so what's be in a class
specification I talked about that a lot
and I really need to to go into it in
some detail to continue to encourage
people to follow those specifications
for one thing it details how the device
behaves you don't need to reinvent the
wheel
please don't we use those specifications
and quite often the discussions that
take place between Apple engineering and
developer technical support and myself
usually end up down to the realm of
where are we not following the
specification what can we do different
and that applies to both Apple and under
developer we appreciate feedback when we
hear that developers are having
difficulty they take the device needs to
spec we really value the dialogue that
we have with the developers to ensure
that we give the best possible support
we can these specifications can be found
at ww USB org I'll talk later about our
recommendations in detail but for right
now if you want to know what's in a spec
go dww USB org so let me talk about the
architecture now in Mac OS 9 if you
haven't heard this before I apologize
because I'm going to go quickly because
we have other things we want to show you
the three or four major components are
the USB manager there's a USB expert the
USB services library and the use of the
interface module now I think I've got a
graphic yes I do at the very bottom of
this whole architecture is actually the
USB host controller above that is the
USB interface module or a whim and the
win actually does the translation from
the basic USD command ap is to the
hardware so that's our hardware
abstraction layer at that lowest level
above that is a USB services library the
USB manager in the USB expert and they
all play different roles the USB
services library takes calls from your
drivers and translates them down into
the USB interface module so doing bulk
reads bulk writes inner up regional rep
rights and so forth take place through
the USB services library the USB expert
in manager are closely related and that
they deal with allowing outside
applications to request information
about what devices are connected receive
notifications about what devices have
been removed locate devices
and match drivers to devices when
they're connected all that layer is not
necessarily available to all clients you
know we couldn't prevent you but we
really drivers should talk to the USB
services library applications shims
control panels should talk to the expert
in the manager as appropriate above that
you can have either a USB shim which is
a special type of code fragment it's a
specific types of a library actually
that gets loaded before they hit parade
and allows you to set things up if you
later on in your knit parade need things
to happen for you you give you a good
example of that cereal USB serial
adapters quite often you'll have some
other admit later in the unit parade
that needs to open a connection to a
serial port and if you don't initialize
or provide the AMA out B&B out
interfaces at that earlier point in the
initialization process then when the
unit comes along it can't locate them it
won't locate them so we provide shims
which are a very early way to get in and
install extra drivers that you'll need
later on during the parade unit table
drivers could be located in shannon's it
could be located just about anywhere and
they provide a translation layer if you
will between applications that need to
do classical IO through device drivers
serial port agin is a great example we
provide in our modem driver a class
driver sorry a device driver a standard
unit table device driver that allows
legacy applications that are used to
using the common tool box or just using
the DNA layout drivers to talk through
to the USB device now bug that Mac OS
and applications they pretty much talked
to either the USB shim or they talk to
the unit table driver when we talk about
the manager and expert and I mentioned
the smoke muncie moments ago one of the
things that we are stress is that we
follow a USB standards rules on how do
you match drivers to devices and you
need to go look at the USB spec to get
the full details on this or in our USB
API reference guide with mac OS I think
there's six acronyms in there
we describe that matching process it
includes looking at the class and
subclass of the device protocol of the
device the vendor and Product ID and the
best possible match wins so when you
write your driver and you create your
driver description structure in Mac OS 9
you define what kind of device that
supports and when the mac OS detects
that device being attached it will look
inside your device driver to see what's
supported we also allow for people who
have registered either in a shimmer unit
table driver to be notified when a
device is connected that's also the
responsibility of the USB manager and
experts they cooperate in terms of
locating drivers installing the drivers
and notifying people above them that
there has been something connected or
disconnected when you're writing a USB
device driver the things that you need
to do pretty much always are select the
configuration of the device if you need
something different than the first
configuration find the interface you
care about if it's a vendor specific
driver find the pipes or end points
within that device and then accessing
this pipe that's the responsibility the
driver we actually think of USB device
drivers predominantly as being just data
transport layers so you create this
driver that then we'll push or pull data
up to a higher level a shim or you know
table driver when a device is connected
and this is one of the little magical
parts of how USB works the part that
actually detects the hardware portion
that actually detects it is in the hub
the hub itself is electrically
monitoring what devices are connected or
at least that a device is connected as a
better way to put it and our hub driver
will receive notification that a new
device has been attached and when it
does it goes out to that device it
enumerates the device that examines the
device and reports what kind of device
it is up to the manager when the manager
sorry the expert the Texas it will then
go off and locate an appropriate driver
and send notification as that's
happening the device itself
is the driver itself is actually called
through its validate Hardware routine to
verify that this actually is a good
device it then calls the initialization
routine and the driver starts
functioning as soon as the device driver
is initialized that's when we send
notification to people who have
requested it I described previously that
driver matching depends upon looking in
the driver itself now in Mac OS 9 we
have a driver description structure in
Mac OS 10 we have an XML bundle in many
ways functionally they perform the same
duties that is they describe what's in
the device driver which devices that
support vendor name sorry vendor ID
product ID etc in 9 the expert uses that
data to determine which whether the
driver is vendor specific or if it's
generic or standard classes now so far
Apple's been the only people providing
standard device drivers we like it that
way we'd prefer that if you're writing
drivers please only right vendor
specific drivers and they take
precedence over Apple standard drivers
so if you have a device that's a
standard class but you really want to
add your own special features or
functionality you can do that it will
take priority over apples standard
drivers so what's inside of a USB driver
well the driver description structure
obviously with all the information then
product ID vendor ID class of class etc
a driver dispatch cable which has entry
points in for validate hardware device
initialization interface initialization
a notification routine where we can't
send you power management messages etc
and a finalized routine and it's very
straightforward to take a USB driver and
add these functions in and get them to
work just by those five basic entry
points one change that we did make back
in mac OS think i'll say 86 was that we
created with USB 1.2 the ability for you
the developer to put multiple driver
drivers into a single file and we parse
through that file looking at all of the
drivers and finding the best map
so no longer starting with a six anyway
do you need to have multiple driver
files and we would prefer you use 86 use
this feature in 1.2 that's better way of
saying it use the feature at 1.2 to
contain multiple drivers don't put
multiple driver files in the extensions
folder anymore and what we've been
telling to people in general is we
really want you to focus on 86 if
somebody has 85 or 85 12 free upgrade to
86 you can just go to the apple website
and tell your customer your customers
can download it that's what we want
people to do is to have them upgrade at
35 or 85 1286 to at least get to usc's
1.2 inside of the driver description
structure there's a number of important
tags and as I said this matches the XML
bundle description in that it has a
vendor and product ID it has a class
subclass and protocol for the device it
has a class subclass and protocol for
the interface you can match either as an
interface driver or you can match as a
device driver and we have some driver
loading options these driver voting
options allow you to tag that this
driver should only be loaded for a as a
vendor specific driver it shouldn't be
loaded as a standard class driver we ask
that you set that bit appropriately and
if whether or not it should load as an
interface driver and there's a tag in
there also that says must match protocol
so we provide some pretty powerful means
for you to clearly define which device
your driver should load for so how do
you get started with mac OS 9 well you
go get our USB ddk from the apple
developer website developer apple com
it's got an entry point in there for
hardware and follow that your USB and we
have the nice for getting started page
for running USB drivers there's also a
USB mailing list which is on that
website that you can join in and that is
a nice collaborative environment where a
lot of developers share experiences and
discuss solutions and the both myself
and the USB engineering team watch that
very closely to see if there's things we
should to jump in with and helpless
where we can and of course we
to go to the usb website the USB WWE USB
org and get those specifications I've
listed the websites here I'll stay on
the slide for a few moments if you want
to copy it down so the exact web address
for USB developers is developer apple
com / hardware / USB / dev info HTM we
want you to join the mailing list we
have a link there or to a page where you
can find information on joining mailing
lists and our DBK is also available our
ddk we've been very aggressively
releasing and I believe we will do our
best to continue in the same way we've
been doing for the last two years we get
that VD k out in beta form early for you
so you can test your devices with it the
other corollary to that is it as a DC
members we really want you to go to the
ADC seed site and get the other updates
that are available for the OS whether
they be multimedia update if it's
released software updates with nowhere
else at cetera please watch very closely
your USB BDK and watch very closely to
Mac OS updates as they come on ABC seed
side one of the reasons why that's very
important to us is we hate with a
passion hearing after we've gone GM with
an OS updates that there's all kinds of
new problems that have been revealed
with that update we want you to report
those problems to as far in advance of
us going GM that's the only opportunity
we have a system so please get the dek
please go to your DC feed side and get
the OS updates so that concludes my
initial presentation and I want to
invite rich kubota up here one of the
things like I said we pulled the inside
USB hardware section to talk to you
about the USB software locator you might
have seen their announcements earlier
this week we have intentionally worked
very hard to be proactive and listen to
your feedback on USB software locator we
did research and we found that the
reason people weren't adopting USB
software locator was because only the
apple and stolen was before
we took that feedback we ran with it and
I'm pleased to announce that we will be
giving out at the end of the suggests
session today beta CDs beta copies of
the Aladdin installer maker for free for
USB software locator this is a special
deal in fact it's a free for USB devices
only one year license to install our
maker the CD itself is the coupon so if
you get a free CD hold on to that CD if
you lose that CD key that's your that's
your coupon you got to have that to get
the free the free update so with that
rich you want to come over and do your
presentation on the thank you thank you
well I'm here to discuss the the updates
to the USB software locator and first I
would like to acknowledge the the
efforts made by Aladdin systems to make
all of this possible they've streamline
the process so we've really simplified
the software located process to make it
easier for you to adopt what I'm going
to do is describe first the process by
which the software locator works and
describe the specific details you would
need to take in order to adopt this
solution the way that the software
locator process works takes advantage of
two important changes that have been
made the first change is implemented in
system software 904 and that is that the
software update now supports the
recognition of disk copy images it's
important for a reason I'll get into in
a second and the second is the fact that
Aladdin systems has enhanced their
installer maker application to work in
cooperation with the Installer engine
first of all when your user attaches
your device and there is no USB driver
found what will happen is that a message
is sent to software update by a USB
software locator to ask well let's see
if we can find a device the user is
presented with a dialog asking whether
you want to search the internet and
assuming they click ok then we search
the USB database which in which will
return information about whether a
vendor has
registered a driver package for that
device that information is returned back
to the user and they are then presented
with the choice of either downloading
lee of the package or not so let's
assume they download the package with
the with the 904 assuming that a disk
copy image has of the package has been
provided that disk copy image is
downloaded it is mounted onto the volume
and our Apple installer engine is
launched it will look within the disk
copy volume for a Apple installer script
which we are providing and that
installer script consists of a single
code resource whose purpose is to look
for the Aladdin stuff an installer maker
document sub launch it and allow that
document to proceed now one of the
enhancements an important enhancement to
the Installer maker application is that
we can now send it Apple events to tell
it to hide any user interface so that it
can operate seamlessly with the Apple
installer engine this was a
demonstration that's Jay presented in
the hardware keynote address on Tuesday
so as soon as the Installer maker and
solar complete control is returned back
to the Installer script code resource
which will then look for whether a USB
shim has been installed and activated
and by doing this activation there is no
need to restart the system control then
comes back to USB and it will perform
the operation of matching the newly
installed driver with the device that is
present so what do we do to get started
on the first thing I'll tell you about
this is this is probably where you will
spend most your time because if any of
you have used installer maker it's a
very simple application to run so first
of all I would recommend that you would
get the USB technote the software
locator technote it is available as part
of the USB ddk it's been there since the
135 release is there in the 141 release
and it will give you the important
information about the process by which
you register a package the web address
is located there but if you already have
the DDK you will have that technote as
part of the DDK you then need to get a
Apple connect ID and assuming that most
girls have already registered with the
ADR or apple developer relations program
I'm you have one so that should be very
easy but if you don't there is a free
online registration process by which you
can get in I d you do not have to become
paid members to get this we just need to
be able to have a way to track you
entering into the end of the database
the next part is that we need to have
you registered with CTS you send a
request to DTS asking that you want to
be registered for a specific vendor ID
now at this time we do request that the
representative of the company that
afford these specific vendor ID be the
one to register is that access next you
create your installer make your document
and that's pretty much running installer
maker you first want to download the
package you will be getting the package
as part of the CD at the end of this
talk and you also have the option of
downloading it from their site you then
if you're going to if you do have a shim
as part of your installation we want to
create a very simple text file it's
named install dot dat and the purpose of
that is that the code resource will look
for that document and look for the name
of the shim so that we know what file to
activate you you add an installer script
which is part of this package and then
you put everything in a folder and with
this copy you would create a disc copy
image you would then use a installer
maker to of to encode the image into bin
Mac binary or h2s format and then
finally place it on an HTTP server or
you can also do it on an ftp server We
strongly recommend that you place it on
to a web server primarily because a lot
of users may be behind firewalls and may
not have their system step for passive
mode to access an ftp server the next
interesting part is using the USB editor
web page at this point i will do a demo
where we show what the USB editor web
page looks like primarily its purpose is
to provide information about the device
ID that you're going to support and then
also to indicate where the software
package will be downloaded and you can
also specify information about whether
the what protocol it is what version of
USB is
wired and other particular pieces of
information to provide backup for the
system to check to see that the current
opera requirements are present so the
simple part of testing the update is
once you've done all this plug the
device in assuming you have system 904
but I forgot one one important step as
part of the USB software locator a
toolkit which we provide in the DDK we
need you first to set the sets of
software updates so that it will look at
a production server we may we've
designed our software update process so
that there are two different servers
there's a production server which
everybody in the world will see and then
we have a staging server that's
specially designed for test processes by
default the software updates process is
designed to look for the production
server so that's all the users with 90
for both we want you to be able to test
this without having your users worry
about it so you there is an option but
it's not provided with the system to
tell you software updates to look at a
staging server and not at a knot at the
production server so with the software
locator switch you can set this option
you would then connect your device and
if everything is set up the the you'll
get the two dialogues I mentioned and
then the download process will begin you
will momentarily see a disk copy image
mounted and in a second later it will
indicate the sea of that the software
package has been downloaded and your
ideally your software driver should be
active for your device now for a quick
demo could I have demo two active thank
you so the web page i mentioned takes
you to this and this is where you would
enter your account name so here we have
rich koo botas ric hku BTW thing and I
enter my connect password click connect
and
I happen to dem demonstrating a
handkerchief site right now so I've gone
in here I've already you if this is the
first time you would add a device I have
already created a device for sample USB
driver you mentioned the name of the of
the of the driver this year or the
device you're going to support in the
name field you specify the class of the
device now one thing I should mention
beef when you registered we you
mentioned a product side a vendor ID so
we've already associated this vendor ID
with York with the record here so now at
this point you're here to define your
product you specify the type of class
there's a pop-up to display the various
types of classes we support the subclass
of the product and for vendor specific
it would be 255 the product ID field and
this will be in decimal not in the hex
which USB Probert would display and the
protocol field and your version you
would save this information and once you
save this information you can now add a
software package for that to support the
device I've already created one here and
here you specify the where the driver
will be downloaded from what size it is
but there's also an important part of
this entry and that is the field that
says move to production once you have
everything more working you would set
set the pop up to yes and it will then
next time that the that we're scanning
for the updates we will see that this is
now set say yes and we will move the
information to the production server and
it will be live to your users indicate
the name of the product in this in the
file name field the size of the download
and destination folder where you want it
to go in the current process it's going
to go to a temporary folder into the off
the desktop and it will be trash the
next time you reboot it the software is
required to use the device you want you
do not require a machine restart after
installation and then you can specify
the the language
and then in this download URL you would
enter the name what the address is to
access a software package there's the
product name and then you can specify
here that you want to require USB one
point four point one to be present this
can be important because by setting this
field people with 90 systems will not be
able to have this down a software
package offered as a possibility you
specify the bin hex file name and again
this can be a binary Mac binary file
name and the version number of this
download you would save this information
and I'm not go save it here and return
back and that's pretty much the
registration process right there at this
time I'd like to recommend to recognize
a fellow member of the USB team and the
Apple directory is simply listed as a
senior software engineer but for all of
us he is the architect for the Makah UF
for USB on Mac os10 roads halliwell so
so rich I've got great news what so my
vision has just come to us and said that
they will be adding support for USB
software locator and very in a very
short while so not only will be Apple
installer work allowing installer maker
and my vision as well so I'm very
pleased to to congratulate my vision for
their participation alright thanks guys
[Applause]
I'm here to talk about where we are in
Mac OS 10 with us be a lot of this is a
review of stuff that you've seen in the
i/o kit presentation or in the firewire
presentation because it's very very
similar with in Mac OS 10 this is sort
of an overview drivers USB drivers in
Mac OS 10 will be using io kit and will
be generally written in C++ at least be
USB classes that we provide an i/o kit
in Mac OS 10 or in C++ I'm going to talk
a little bit about the difference
between kernel-mode drivers and user
mode driver
very similar to the firewire drivers
going to talk a little bit about how Mac
os10 does driver matching and loading
about the benefits of having blocking
i/o and Mac OS 10 and a little bit about
the multi-threaded drivers comparing Mac
OS 9 and Mac OS 10 in Mac OS 9 the
driver description is in the code
fragment of the driver whereas in Mac OS
10 it's part of the XML bundle for the
driver scheduling under mac OS 9 is all
done asynchronously with callback
routines in Mac OS 10 you're not
required to use asynchronous drivers
because you can do blocking i/o
programming in Mac OS 9 we pretty much
all of our interfaces or see interfaces
in Mac OS 10 we use embedded C++ just
like the rest of I Oh Kip and its object
oriented programming with all the
benefits there in the driver framework
inside of Mac OS 9 is specific to USB
whereas in Mac OS 10 we get all of i/o
kit to work with so for example whereas
in Mac OS 9 the notification of the
addition or removal of USB devices is
handled by the USB manager in Mac OS 10
it's handled by I Oh kit in i/o kit I
okay it provides us with many services
that were in the mac OS 9 were provided
by the USB system itself which frees up
USB to be well much simpler the XML
bundle in the Mac os10 driver contains
the driver information necessary for i/o
kit to match and load a driver and
because we are written in C++ it speeds
the development time by allowing object
inheritance from standard i/o kit
objects makes the API it's just a little
cleaner so when you're developing a USB
driver in Mac OS 10 similar to firewire
drivers you want to ask yourself first
of all do I need to write a kernel mode
driver or a user-mode driver does my
driver live in kernel space where
resources are expensive or in user space
where resources are relatively cheap and
to answer this question you need to ask
for basic questions very similar to
firewire is your driver used by the
kernel if so it needs to be a kernel
driver is your driver used by very many
of the tasks in the system if so it
needs to be a kernel driver does your
driver require access to primary
interrupts if so it should be a kernel
driver and if you need tight
synchronization between various tasks
that your driver performs and if so you
need a kernel driver so some concrete
examples of drivers that would be kernel
mode drivers versus user mode drivers
keyboards and mice need to be Colonel
drivers because they are used by just
about every test every user visible task
in the system mass storage driver would
need to be a kernel mode driver because
the colonel would use the mass storage
for for storage whereas a scanner driver
would be a user mode driver or a printer
driver would be a user mode driver a
cd-r driver again we go back to the
firewire example the CD part of it where
you just looking at a CD in the device
would tend to be a kernel mode driver
whereas the the part of the driver that
actually broke to the cd-rom device CDR
device would be a user mode driver USB
because the the USB stack inside of i/o
kit shares in the rest of the i/o kit
stack in that it you can perform
blocking I oh it has its multi-threaded
and so you can block from your driver
can block without blocking the rest of
the USB system this simplifies driver
designs by not making a requirement that
you have all kinds of callback routines
in your driver but callback routines are
available if you need them part of a in
iokit driver and therefore a USB
driver is an XML driver description this
is a file that is originally edited with
text it contains all the information
that otherwise appears in Mac OS 9 it
appears as in the driver description
table and contains information such as
product and vendor IDs class subclass
protocol of the device and gives the
information necessary for i/o kits to
match a driver for a particular device
or a particular interface within a
device the way driver loading works in
Mac OS 10 is the following the there is
a hub driver attached that is driving
every hub in the system including
including the root hub and this hub
driver can detect when a device is
attached to the USB bus and it
enumerates device the device it tells
the controller to create an IO USB
device object for that device and then
it registers that object with IO kit
causing that IO USB device objects to
become a what is what is called an IO
kit a nub that nub is now looked we look
through the system all of the XML files
basically that are in the system and I
ok it finds the appropriate driver to
load against that nub it loads it
attaches it to the to the nub
initializes the driver updates the IO
registry so that this nub now appears in
the IO registry and then the driver run
starts running and can load other
objects as necessary so here's a picture
of what Mac OS kernel drivers would look
like at the bottom level we have the USB
dub for the for the USB controller
itself which is a pci device we have the
PCI driver for that kernel which we call
Apple ohci we have a couple of USB
devices on top of those devices we have
drivers
and because there are Colonel drivers
they both they live the low the colonel
boundary and there are other operating
system objects that might be attached to
those drivers to provide service across
the colonel boundary up to the
application or the user layer a user
mode driver looks very similar for a
while you have the USB knob to which the
USB controller object driver is attached
you have a USB device and then the
driver for that device is actually a
user mode driver that lives above the
colonel boundary for example a scanner
driver so where does USB live those of
you who've been to the i/o kit
presentation of the firewire
presentation recognize this slide the
USB drivers the USB stack lives with IO
kits in the in the kernel next to the
mach kernel and as william said there's
a dotted line which sort of indicates
that it may be possible that an USB
driver would not actually have to use
the file system or networking or the BFC
colonel in order to talk to the layers
above the colonel boundary so now if
you're like me and i know that i am
there is a more concrete example for how
we match and load a driver would be
useful so we're going to start here and
i'm going to talk about human interface
devices specifically mice and keyboard
because those are drivers that the
source for these two drivers is in
darwin so you can actually look at
darwin and follow along with what i'm
saying here so the bottom layer we have
the the driver for the USB controller
the name of this class that this object
is is Apple ohci and it's a subclass of
the IO USB controller class once this
object comes it loads a route it
instantiates the root hub loads the root
hub driver and that root hub driver then
tells
d controller to go out onto the bus and
find all the USB devices so it goes out
and it finds a io USB it finds two USB
devices in this case a one and
instantiate what are called nubs these r
io USB device nubs one of them will end
up having a name in the io registry of
in this case M 4848 which is the old
original apple USB mouse or M 2452 which
is the original apple USB keyboard so
these are not drivers these are nubs
that represent the device and they
contain inside of their objects
information about the device these the
io kit then tries to load drivers for
these devices and as they are both
composite devices the driver that gets
loaded is the Apple composites driver
each one of them gets a separate
instantiation of the Apple composite
driver the Apple composite driver then
goes out and sets in and chooses a
configuration in the device and in this
case it always chooses the first
configuration and then it asks for the
interfaces that are part of that
configuration these interfaces then
appear these are nubs that the that are
attached to the device they contain
information about the class subclass
protocol and so forth of the interface
and then our published to io kit I oak
it then goes out and says okay now I
need drivers for these two devices well
for the mouse the driver that gets
loaded is the apple mouse driver for the
keyboard the driver that gets loaded is
the Apple keyboard driver the apple
mouse driver is a subclass of the io h i
pointing class which in turn is a
subclass of the io h I device class the
keyboard similarly is a subclass of IOH
I keyboard which is a subclass of IOH I
device so at this point we now have a
driver that knows how to get information
from that through that interface from
that device so what is it going to do
with that information well within Mac
os10
there is in this particular case an
object that was instantiated long before
this occurred called the io hid system
and the IO head system tells itself when
it tells the system which tells io yet
when it is expand she ate 'add
instantiated that it wants to know about
any device that appears that is of that
is a subclass of I ohi device so both of
these are it is notified about both of
them and it attaches itself to both of
them the io hid system has as part of it
the io head user client which is the
part that allows it to pass information
across the colonel boundary and its
clients across the colonel boundary is
the window manager so in this so so is
because the mouse complies to an H I
device or is a subclass of H I device
and the keyboard is a subclass of HCI
device they automatically get attached
to the hid system or in fact the hid
system gets attached to them and we get
information passed up to the system
without any other effort on the on the
part of the driver writer so I want to
talk a little bit about the various
classes that make up the USB family in
in Mac OS 10 the IO USB controller class
is the heart of the USB family and it is
through this class that the data
transfer occurs to the actual hardware
this is what we would call the wim in
Mac OS 9 the Apple ohci driver is a
particular instantiation of this class
that accesses the USB host controller
driver inside of every mac that we have
today the IO USB device class is a class
that gets instantiated once per device
on the USB bus and this class is
responsible for maintaining the node ID
it is matched by I oak it based on USB
vendor ID product ID and so forth and
its main job is to publish and
is to publish nubs of class io USB
interface the IO USB interface class
there is one of these instantiated / in
interface on a particular configuration
per device and this class instantiates
and distributes to the drivers objects
of type io USB pipe the IO USB pipe
class is the the objects that the
drivers will use to actually read and
write data to and from the USB bus
there's one pipe there's one pipe /
interface sorry there's one of these
objects / pipe on each interface and
this object provides the methods for
data transfer so a driver will will be
attached to an IO USB interface nub and
we'll ask that interface enough to give
it the pipes in our example that I
showed a minute ago if the device is an
io h I device currently in DP for if
that device is either a chai pointing or
a chai keyboard then the hid system will
automatically attached to it and there
is an API that the hid system uses to
pass keyboard and mouse data up to the
user space of Mac OS 10 so I want to
switch to demo 1 and what we have here
is system running dt4 and I wanted to
show the hid stack that I was talking
about using a tool that's NDP for called
io registry Explorer so with this tool
you'll see here that we have the Apple
ohci that is the object in IO registry
Explorer that is the driver for the USB
controller chip and it has and this is
the IO service plane and it has 4
devices attached to it it has the root
hub it has a hub inside the keyboard it
has the keyboard which on my slide was
m24 52 or and it has the mouse so we
will look at the mouth the apple USB
mouse this is this is the class of this
object is IO USB device but its name is
USB apple mouse this this is a nub a
driver was loaded against this nub in
this case the name of the driver was
apple composite the apple composite
driver told the USB mouse to publish an
interface there's the interface this
interface was then published and I oak
it matched the driver against it the
name of the driver that was matched
against it is apple mouse is this apple
mouse the class name is apple mouse the
subclass was is IOH i pointing and the
sub that in terms of class of I ohi
device so because it's an io h AI device
we have the hid system that was
automatically notified and matched
against the apple mouse and the hid user
client is then used to pass the mouth
information up to the window manager and
i think that's it for the demo so we'll
go back to the slides and that's it for
me so I guess Craig comes back up thank
you thanks road so let's compare the
differences between mac OS 9 and macro
is ken we're really not that dramatic
the api's are essentially the same not
going to claim that the names are
identical but the basic functionality is
you have the ability to read and write
on pipes you have the ability to locate
to those pipes in the interface you can
use if you need to call back routines so
in many ways the mechanisms that you use
in line would be the same mechanisms for
communicating with a device that you
will use in 10 the driver description
mechanism of vendor ID product ID class
subclass protocol we follow the rules in
the USB specification for matching those
devices so what's in DP for well those
roads put it out we have the keyboard
and mouse we also have USB printing to
postscript printers so we certainly are
going to do more later one thing I do
want to mention though is that we're
fine-tuning the USB driver and object
names and expect them to change after
vp4 we haven't finalized those names yet
so what's going to be in the public beta
well what's in cd4 + some basic USB
mass-storage that's expected that's
we're planning on doing for DP sorry for
public beta is to add basic USB mass
storage and that basically means things
like super disks that drives etc very
basic USB Mass Storage so beyond Mac
os10 public beta we're going to add much
of the same functionality we have nine
to ten so hid devices hopefully you've
seen some of the hid manager
presentation that talk about what we're
going to be doing in mac OS can we will
have the support in the hidden manager
for USB HID devices so right now as an
example you can use the hid parser in
Mac OS the hidden support library and
Mac OS line to do this the same
functionality would be achievable with
the hidden manager in Mac OS 10 where
you can control us be enabled UPS's us
be enabled displays if you have a kid
interface in a USB display you would be
able to write a display control panel
that would use that hid interface to
control the display gaming devices all
the hid USB devices I've seen comply
with the standard with very rare
exception and you'll be able to use the
hidden manager in mac OS ken to use that
tablets and graphical other pointing
devices will also be accessible through
the hid manager we're still going to
have USB printing to postscript printer
we're going to have more USB Mass store
devices I'm not really able to predict
exactly which ones will be just yet but
we're certainly going to add a lot more
and will also support USB audio oh and
one last thing that modem that d90 v25
turkeys compatible modem will also be
supported sometime after Mac OS public
necklace and public beta so what do I
want you to take away from here today
well as far as mac OS ken goes we
believe that c++ embedded C++ and I oak
it is a great way of writing drivers all
of our drivers use io kit we find it
very powerful if you listen to being
released talk into iokit presentation
they were they came up with the
architecture and as they started writing
drivers that became more and more
pleased with the object inheritance and
the ability to do blocking I oh we also
updated as you might expect as you've
seen on these slides we now have a mock
colonel we have a BF v kernel that
allows the really great driver writing
we're blocking I oh and multi threading
etc and I can't tell you that you'll be
able to just take your USB drivers from
nine and directly could take the sources
over and attend and go forward but based
on your understanding of how your mac OS
9 driver works the same basic
fundamental mechanisms of communicating
across pipes and pushing data up to
higher level objects will be very
similar intent as it is in nine so how
do you get started with mac OS 10 well
PG for going fault go play with it to
look at it go investigate it look at the
KPK go take a look at the KDK it has
some example drivers in there today
certainly we're working on improving the
documentation but in the meantime please
do the aisle kit tutorials that come
with the KD k and read through the USB
header files that'll give you a very
definite direction of where we're going
and what we're doing so what do we
recommend well I don't know if I put it
on the sly
but it will certainly be emphasized it's
very key please for mac OS 9 gets the
USD DBK try it go to the atcc light gets
the USD get these sorry I get the OS
updates that we do try to give us
feedback we really want to know what you
think we really want to get feedback
file bugs using a DC's online bug
reporting system let us know before we
go GM because we can't fix Hadiya relief
after we released it please try BTW try
the DD k try the ADC seed site software
releases that's very key so what you
need to do to be sexual successful with
USB is you absolutely need to be in
compliance with the USB class
specification go to ww USB org gives the
class specifications read them follow
them implement your devices to them
follow the standard classes follow the
USB specification and device enumeration
and power commits consumption and all of
the communication protocols that's
absolutely crucial we follow those specs
as best we can you should too at least
if you do you'll tremendously improve
your development time because you'll use
be able to use the standard apple
drivers if you look at those
specifications and you find that they
don't be earring age exactly then
there's a good thing you can do join the
USB is implementers forum go to the
device working groups tell them what you
want participate in the voting process
don't just look at a class specification
you decide this is not for me it doesn't
do what I want if you feel passionately
about getting some feature put in the
class classification join the IAF get
your vendor ID go to the device working
groups participate in that discussion
and get your features added I heard
earlier today that for example with the
video imaging live video features with
USD but that spec is still being talked
about if you want to do a USB video
device please go join the USB I f go to
the device working groups give your
feedback on
you think video devices should be it's
important as far as business planning
stuff goes tell this to your marketing
people license the mac OS logo put it on
your box make it clear and distinct this
works for the macintosh follow the
guidelines for the logo usage put it on
your marketing collateral put it on your
advertising mention it in your press
releases do that that's the way that we
communicate to our customers that this
product works for the mac if you're
marketing people come to you and say
here's the box design and it doesn't
have the mac OS logo and prominently
displayed on the front tell them in
statically go get the mac OS logo
license and we can help with that the
logo license is free there's
recommendations on how to use it in
terms of sizing and placement but
absolutely go get the mac OS logo and
use it put your products in the
macintosh products guide as a TC members
that's free well it wouldn't be
expensive it wouldn't accept you have to
become an ADC member it go become an EDC
member get your products listed in the
products guide we take that products
guide online database and we
periodically press tv's and give those
cds out at macworld if you want your
customers your potential customers to
know about your products get them into
products guide you'll note that on our
homepage now www apple com in the very
center there's a maid for Mac click spot
a button that takes your customers to
the Macintosh products guide if you want
your product seems I customers get it in
the Macintosh products guide support the
USB software locator we've listened
really hard we've worked really hard to
understand what the issues are we talk
to developers who devices art in the
software locator and ask them to tell us
what the issues were we took that
feedback and we aggressively got aladdin
and I'm very pleased to say again that
mine regime has stepped up and they're
going to do this the same thing for
their installer you don't have to use
apples in store that's the feedback we
heard you didn't like using the Apple
installer to use USB software locator we
addressed that and you should now have
no reason for your vendor specific
devices to to not have your software on
the USB software locator
so how you make a device class
compliance I sure to put this slide a
little earlier and I'll do it now join
in familiar form they assign us the
vendor IDs we have a number of product
out there not ours we see mendler
products there where they the actual or
company name on the device is different
than the vendor ID that's in the device
itself so you'll see for companies
entirely different devices using the
same vendor ID well I tell you with the
USB software locator we have a little
bit of a problem we try to match up your
developer connection ID connect ID with
the vendor ID we don't want one
developer going in and messing around
with another person's software so please
go join the USB I up get your own unique
vendor ID and use it don't create a
device where you buy a chip from
somebody else and just use their vendor
ID get your own vendor ID the other
thing that they do that you should
participate in is they have these
periodic compliance workshops I think
three quarters out of the year they're
in milpitas the fourth quarter out of
the year they're in taiwan and these
compliant workshops or these great
events where everybody walks around with
their devices plug them into the OS
whatever that OS is our somebody at some
of our competitors etc and verifies that
they function and it's great feedback
for us we try to go and with that no
conflicts with our engineering schedules
to meet with the developers and see what
we can do to help make our sophomore
better and help make their devices
better participate in the USB device
working groups if you feel passionately
join that process make your voice heard
and as I've said a couple of times www
USB org
you