开发者

Driver Portability

This might be a lame question for this site, but here goes.

Can drivers be portable? For instance, could one write a driver for the keyboard-backlight of a mac, and port it to another unix system, maybe Solaris?

or is driver portability a contradiction in terms?

any articles covering this topic would be m开发者_高级运维uch appreciated.


Device drivers need to serve two layers of abstraction which makes portability at least hard:

1) Of course the driver needs to be written for a specific device. Your understandable assumption is now that once I implemented a driver according to a proper device specification (data sheet, ...), why shouldn't it run on every computer that needs to access the device.

In comes point

2) Drivers are written to fit into a certain operating system. Each OS has its own means of

a) accessing devices, e.g., the functions for reading/writing I/O ports might be called differently or have different signatures. Furthermore b), the ultimate goal of a driver is to make the device accessible to the user - be it through a file system interface or network sockets or the X input protocol. For these purposes each OS again comes with its own set of abstractions that the driver needs to fit into.

These are the reasons porting drivers is kind of hard. Nevertheless, there are approaches that try to achieve this, most of the time by wrapping the original driver with glue code that translates the expected driver/OS interface into the target interfaces.

  • NDISWrapper is a library that allows running Windows WiFi drivers on Linux,
  • Some guys from Karlsruhe proposed to use device-driver virtual machines,
  • Several OS frameworks I'm aware of use device-driver wrapper libraries to run Linux/BSD device drivers in their environments. See for instance Genode, L4Re, Minix3.


Yes, they can be. Assuming a driver is written for the device specifications, the only thing that prevents the driver portability is the underlying operating systems as different operating systems have different architecture and different controls to call and load device drivers. But there have been known implementations, wherein the underlying OS could be abstracted and a uniform platform could be provided. This can lead to driver portability.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜