Writing Function Driver Implementations Tutorial

This tutorial explains how to write Function Driver Implementations.

Purpose

Function Driver Implementations (FDIs) use the USB Driver Interface (USBDI) to drive a USB function. This document explains how to use the USBDI. Because the composition of every Function Driver Implementation will depend on the part of the operating system in which it functions (for example a Mass Storage Function Driver must integrate with the File System while a keyboard function driver must integrate with the Front End Processor or Windows Server), every FDI will be different. The FDI may for example be a standalone executable file, a combination of executable files or a plug-in to a pre-existing subsystem. Therefore this document focuses on general details rather than the specifics of a particular implementation.

Intended audience

This document is for platform developers who are designing Function Drivers (FDs).

Required background

You need to be familiar with the USB technology and standard Symbian platform idioms.

You need to have read the Writing Function Driver Controllers Tutorial.

Introduction

Setup and Configuration Requirements

The part of the FDI that uses RUsbInterface and RUsbPipe needs the CommDD capability. If the part of the FDI that uses RUsbInterface and RUsbPipe is a DLL that is linked to by, or that plugs into, some other process, that process also needs the CommDD capability.

Before you make use of RUsbInterface or RUsbPipe, you need to load the executable which contains them, the Logical Device Driver. To do so you must include a suitable call to User::LoadLogicalDevice.

_LIT(KDriverLddFileName,"usbdi");
TInt err = User::LoadLogicalDevice(KDriverLddFileName);
//Handle errors

When you have finished using and have closed all instances of RUsbInterface and RUsbPipe, you need to close the Logical Device Driver.

TInt err=User::FreeLogicalDevice(RUsbInterface::Name());
//Handle errors

Writing FDIs

The Following tasks will be covered in this tutorial: