這個論壇的目的?
1. fun
2. 練習創意
3. 商機無限
餿主意讚 |
造訪此群組 |
-> BOOL Cl13611OTG::UpdateInput()
-> BOOL Cl13611OTG::EventNotification()
-> BOOL USBOTG::EventNotification() @ Usbotg.cpp (\wm\public\common\oak\drivers\usbotg\mdd)
do
-> BOOL Cl13611OTG::UpdateInput() @ Cl13611.cpp (\wm\platform\qcmsm\src\drivers\usb\highspeed\otg)
-> USBOTG_STATES USBOTG::StateChange(USBOTG_STATES usbOtgState) @ Usbotg.cpp (\wm\public\common\oak\drivers\usbotg\mdd)
-> BOOL USBOTG::EnterState(USBOTG_STATES usbOtgState)
if (OTG state has changed)
BOOL Cl13611OTG::NewStateAction(USBOTG_STATES usbOtgState , USBOTG_OUTPUT usbOtgOutput) @Cl13611.cpp (\wm\platform\qcmsm\src\drivers\usb\highspeed\otg)
-> BOOL Cl13611OTG::SetupTransCtr(USBOTG_OUTPUT usbOtgOutput)
if(usbOtgOutput.bit.drv_vbus)(A-device is driving Vbus)
turn on Vbus
else
turn off Vbus
if (usbOtgOutput.bit.loc_sof = true) (loccal device is generating activity on the bus)
LoadUnloadHCD(TRUE)
else
LoadUnloadUSBFN(TRUE)
-> BOOL USBOTG::NewStateAction(USBOTG_STATES usbOtgState , USBOTG_OUTPUT usbOtgOutput )
elsebreak while()
while(OTG state != USBOTG_states_unknow)
Keep these points in mind when you are selecting a system image target for your AVD:
The API Level of the target is important, because your application will not be able to run on a system image whose API Level is less than that required by your application, as specified in the minSdkVersion attribute of the application's manifest file. For more information about the relationship between system API Level and application minSdkVersion, see Specifying Minimum System API Version.
Creating at least one AVD that uses a target whose API Level is greater than that required by your application is strongly encouraged, because it allows you to test the forward-compatibility of your application. Forward-compatibility testing ensures that, when users who have downloaded your application receive a system update, your application will continue to function normally.
If your application declares a uses-library element in its manifest file, the application can only run on a system image in which that external library is present. If you want your application to run on the AVD you are creating, check the application's uses-library element and select a system image target that includes that library.
http://developer.android.com/sdk/1.1_r1/index.html |
D:\workplace\android-sdk-windows-1.1_r1\tools>emulator |
D:\workplace\android-sdk-windows-1.1_r1\tools>adb pull /proc/config.gz |
CONFIG_MODULES=y |
ARCH ?=arm CROSS_COMPILE ?=../prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- |
# LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,$(call ld-option, -Wl$(comma)--build-id,)) |
$make mrproper |
$make |
/* * devone.c * */ #include linux/init.h #include linux/module.h #include linux/types.h #include linux/kernel.h #include linux/fs.h #include linux/cdev.h #include asm/uaccess.h MODULE_LICENSE("Dual BSD/GPL"); static int devone_devs = 1; /* device count */ static int devone_major = 0; /* dynamic allocation */ static int devone_minor = 0; static struct cdev devone_cdev; ssize_t devone_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) { int i; unsigned char val = 0xff; int retval; for (i = 0 ; i < count ; i++) { if (copy_to_user(&buf[i], &val, 1)) { retval = -EFAULT; goto out; } } retval = count; out: return (retval); } struct file_operations devone_fops = { .read = devone_read, }; static int devone_init(void) { dev_t dev = MKDEV(devone_major, 0); int alloc_ret = 0; int major; int cdev_err = 0; alloc_ret = alloc_chrdev_region(&dev, 0, devone_devs, "devone"); if (alloc_ret) goto error; devone_major = major = MAJOR(dev); cdev_init(&devone_cdev, &devone_fops); devone_cdev.owner = THIS_MODULE; devone_cdev.ops = &devone_fops; cdev_err = cdev_add(&devone_cdev, MKDEV(devone_major, devone_minor), 1); if (cdev_err) goto error; printk(KERN_ALERT "devone driver(major %d) installed.\n", major); return 0; error: if (cdev_err == 0) cdev_del(&devone_cdev); if (alloc_ret == 0) unregister_chrdev_region(dev, devone_devs); return -1; } static void devone_exit(void) { dev_t dev = MKDEV(devone_major, 0); cdev_del(&devone_cdev); unregister_chrdev_region(dev, devone_devs); printk(KERN_ALERT "devone driver removed.\n"); } module_init(devone_init); module_exit(devone_exit); |
KERNELDIR=/home/arik/Workspace/aydroid/kernel/ PWD := $(shell pwd) obj-m := devone.o modules: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: rm -rf *.o *~ core.depend .*.cmd *.ko *.mod.c .tmp_versions |
D:\workplace\android-sdk-windows-1.1_r1\tools>emulator.exe -kernel D:\workplace\ android-sdk-windows-1.1_r1\tools\lib\images\zImage |
D:\workplace\android-sdk-windows-1.1_r1\tools>adb remount * daemon not running. starting it now * * daemon started successfully * remount succeeded |
http://benno.id.au/android/busybox |
D:\workplace\android-sdk-windows-1.1_r1\tools>adb push busybox /system/bin 1703 KB/s (0 bytes in 1745016.001s) |
D:\workplace\android-sdk-windows-1.1_r1\tools>adb shell # chmod 566 /system/bin/busybox chmod 566 /system/bin/busybox #_ |
D:\workplace\android-sdk-windows-1.1_r1\tools>adb push devone.ko /system/bin 117 KB/s (0 bytes in 3763.000s) |
D:\workplace\android-sdk-windows-1.1_r1\tools>adb shell # busybox insmod /system/bin/devone.ko busybox insmod /system/bin/devone.ko # busybox lsmod busybox lsmod Module Size Used by Not tainted devone 2624 0 # |
# busybox cat /proc/devices busybox cat /proc/devices Character devices: 1 mem 4 /dev/vc/0 4 tty 5 /dev/tty 5 /dev/console 5 /dev/ptmx 7 vcs 10 misc 13 input 29 fb 90 mtd 128 ptm 136 pts 252 devone 253 ttyS 254 rtc Block devices: 1 ramdisk 7 loop 31 mtdblock 43 nbd 179 mmc # |
# busybox mknod /dev/devone c 252 0 busybox mknod /dev/devone c 252 0 # busybox ls -l /dev/devone busybox ls -l /dev/devone crw-rw-rw- 1 0 0 252, 0 Apr 30 02:26 [1;35m/dev/devone[0m # |
cd\tools
adb pull /proc/config.gz pulldata\config.gz
C:\WT\SoftWare\eclipse\android-sdk-windows-1.1_r1\tools\lib\images。
emulator -image system.img -data userdata.img -ramdisk ramdisk.img
emulator -kernel/zImage
emulator -image backup\system.img
I'm trying to create a fake character device.
I want to make it usable within the provided Android emulator.
Firstly, I recompiled the Android Kernel editing the .config file,
adding CONFIG_MODULES.
Then, I wrote a module managing "/dev/mydev" (it acts as a 80 char
buffer) and crosscompiled it for arm architecture.
I ran the emulator and pushed busybox (for creating the /dev/mydev
with mknod) and loaded the module with insmod.
Now, both shell and common activities can interact with it, by using
standard open/close/write/etc...
I would like to create a specific permission for that device and make
it not readable from common Activities.
Is there some documentation/hints/links?
I know Android has a specific HAL but there's no documentation.
For application style permissions, what you generally do is define a new gid
that your device is published under (so it is not world readable/writeable),
add an entry to etc/permissions.xml mapping that gid to a permission string,
and add an item in the frameworks AndroidManifest.xml describing that
permission.
The meaning of groups is purely defined by user space. There is a
system/init header that defines the standard groups.
If I want to create a new device, conforming to Android HAL, I should
use one of the following approaches:
1. App - Runtime Service - lib
2. App - Runtime Service - Native Service - lib
3. App - Runtime Service - Native Daemon - lib
Except for the existing devices, it is not easy to identify all the
files which need to be modified for adding a new one.
I am also interested in writing a User-Mode Driver, instead of using a
Kernel-Mode Driver model.
For now, I want to make it work in the emulator.
My fake device will be similar to "sensor" device.
I tried to create a library calling it "fake" and managing all
necessary features.
I put them into /hardware/libhardware/fake, /hardware/libhardware/
include/fake, with its Android.mk.
It relies on /dev/fake and /dev/input/fake (one for data, the second
one for control).
First question. There's a standard way in Android Project Group for
adding a new device (kernel and/or user model)? (Folders where files
should be placed, tips for makefiles, etc? The device /dev/input/
compass is managed by which driver?)
There's a stub for implementing a new device and related Manager/
Services, to higher levels up to Application?
Android 的抽像層不可否任地是前後茅盾的。Audio 和camera 都是C++純虛擬介面,但其它地方像LED 和blitter 就有function pointers 的 C 結構.
因為我們是在模擬器上跑一個實體device 的image,任何在模擬器背後沒有kernel driver 的devices 都需要一個假的device(像是camera)。對audoi來說,我們有kernel driver在模擬器上,但是其它的device 像是G1 在kernel driver 的上方有個user space 層。
就這個case 來說,就有個小程式轉換AudioHardwareInterface 到呼叫kernel calls.
要如何寫driver 功能的介面給application ,取決於你打算怎麼做。大部份的硬體功能都有抽象層在現有的service裡。例如 2D graphics 有 SurfaceFlinger,audio 有AudioFlinger, camera有CameraService(因為CameraFlinger聽起來很奇怪)。在這樣的架構下,讓我們在用binder interface 時有一定的安全性,並將大部份的不同性抽象化,好讓applications 不用管硬體
我還沒實際去看這個部份的code, 但是我可以給你一個以camera 為例子的例子,來說明
在最上層是 android.hardware.Camera, 就是當application 拍照時會跑的Java object。它就是個小的wrapper在 android_hardware_Camera.cpp,也就是JNI介面。接下來,有另一個wrapper 在libs/ui/Camera.cpp,這個cpp是一個代理,專門for camera service 的remote object用。沒錯,放在libs/ui是蠻奇怪的,不過沒辦法,有些環境相依性的問題關於Surfaceflinger, 所以就這麼定了。
現在,有趣的是,有個binder interface 叫做ICamera.h (純虛擬的),它被寫在ICamera.cpp裡,而ICamera.cpp 是marshalling code for IPC binder 呼叫的。我們只要相信,從client 來的呼叫,會導致一個marshalled 的ICameraClient object 顯示在server端的介面上。在建立連結上(所謂連結就是application 提到許可來使用camera),camera service會具現化 CameraHardwareInterface 而取得object, 這個object 就是實體camera 硬體用的HAL。而camera service 會處理preview 顯示,還有其它低階的內在功能(Java app會比較困難處理的部份)。
Camera hardware driver 可以寫成一個kernel driver 跟一個小user space 的driver, 或是寫成user space driver 跟一個小kernel dirver(主要是控制存取部份).
這是比較複雜的device models的其中一個。其它的devices(像是LEDs)就有比較簡單model
It depends, most of the time you'll need to do something like:
app -> java api (manager) -> java service -> HAL module -> kernel
Sometimes (it's the case for the sensors), there is an extra native
daemon, but in this particular case, it's an implementation detail
(the sources for that daemon are proprietary).
Sometimes, the "java service", can be replaced directly by a "native
service", thanks to the binder interfaces (they're agnostic to the
languages involved, so a service can even be rewritten from java to
C++ or vice-versa, without breaking compatibility).
In some cases, it is also possible to skip the "java service"
entirely, if the HAL module can handle multiple clients and all the
permissions involved.
It is also possible to have a mix and match, this is the case for the
sensors; the service is used to establish a connection with the
hardware, but all the data moving is done by talking directly to the
HAL module from the the app.
So, in short, there are no rules. It depends on what you're trying to
accomplish.
plug out
03/19/2009 21:43:51.735 - UsbComm: Change DTR to 0.
03/19/2009 21:43:51.735 - UsbComm: Closed device.
03/19/2009 21:43:51.767 - USB: Event 32772, name \\?\USB#Vid_05e0&Pid_2000#2f5b1900-11fe-0801-4d4f-303937303863#{25dbce51-6c8f-4a72-8a6d-b54c2b4fc835}
03/19/2009 21:43:51.767 - USB: Device Remove Complete notification
03/19/2009 21:43:52.001 - USB: RNDIS device id \\?\USB#Vid_05e0&Pid_2000#2f5b1900-11fe-0801-4d4f-303937303863#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
plug in
03/19/2009 21:44:13.622 - USB: RNDIS device id \\?\USB#Vid_05e0&Pid_2000#2f5b1900-11fe-0801-4d4f-303937303863#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
03/19/2009 21:44:13.825 - USB: Event 32768, name \\?\USB#Vid_05e0&Pid_2000#2f5b1900-11fe-0801-4d4f-303937303863#{25dbce51-6c8f-4a72-8a6d-b54c2b4fc835}
03/19/2009 21:44:13.825 - USB: Device Arrival notification
03/19/2009 21:44:13.825 - UsbComm: Open device.
03/19/2009 21:44:13.825 - UsbComm: Change DTR to 1.
03/19/2009 21:44:13.840 - Serial: Starting device detection at 115200.
03/19/2009 21:44:13.840 - UsbComm: Change DTR to 1.
//////////////////////////////Rndis to Serial @WCESCOMM.log
03/19/2009 13:56:22.199 - USB: RNDIS device id \\?\USB#Vid_05e0&Pid_200d#2f5b1900-11fe-0801-4d4f-303937303863#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
03/19/2009 13:56:22.433 - USB: found RNDIS device id USB\Vid_05e0&Pid_200d&Rev_0000
03/19/2009 13:56:22.433 - USB RNDIS: Device Removal notification
03/19/2009 13:56:23.543 - USB: RNDIS device id \\?\USB#Vid_05e0&Pid_2000#2f5b1900-11fe-0801-4d4f-303937303863#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
03/19/2009 13:56:23.699 - USB: Event 32768, name \\?\USB#Vid_05e0&Pid_2000#2f5b1900-11fe-0801-4d4f-303937303863#{25dbce51-6c8f-4a72-8a6d-b54c2b4fc835}
03/19/2009 13:56:23.715 - USB: Device Arrival notification
03/19/2009 13:56:23.715 - UsbComm: Open device.
03/19/2009 13:56:23.715 - Serial: Starting device detection at 115200.
03/19/2009 13:56:23.715 - UsbComm: Change DTR to 1.
03/19/2009 13:56:23.715 - UsbComm: Change DTR to 1.
03/19/2009 13:56:24.230 - AutobaudDetect: Found character.
03/19/2009 13:56:24.230 - AutobaudDetect: Found character.
03/19/2009 13:56:24.230 - AutobaudDetect: Found character I.
03/19/2009 13:56:24.230 - AutobaudDetect: Found character.
03/19/2009 13:56:24.230 - AutobaudDetect: Found character.
03/19/2009 13:56:24.230 - AutobaudDetect: Found character.
03/19/2009 13:56:24.230 - Serial: Unimodem handshake at 115200.
03/19/2009 13:56:24.230 - Proxy: Change connection state 1.
03/19/2009 13:56:24.230 - Proxy: Created dynamic proxy on port 5655.
03/19/2009 13:56:24.246 - Proxy: Created dynamic proxy on port 3000.
03/19/2009 13:56:24.246 - Proxy: Created dynamic proxy on port 3001.
03/19/2009 13:56:24.246 - Proxy: Created dynamic proxy on port 3002.
03/19/2009 13:56:24.246 - Proxy: Created dynamic proxy on port 3003.
03/19/2009 13:56:24.246 - Proxy: Created dynamic proxy on port 3004.
03/19/2009 13:56:24.246 - Proxy: Created dynamic proxy on port 3005.
03/19/2009 13:56:24.246 - Proxy: Created dynamic proxy on port 3006.
03/19/2009 13:56:24.261 - Proxy: Created dynamic proxy on port 3007.
03/19/2009 13:56:24.261 - Proxy: Created dynamic proxy on port 3008.
03/19/2009 13:56:24.261 - Proxy: Created dynamic proxy on port 3009.
03/19/2009 13:56:24.261 - Proxy: Created dynamic proxy on port 3010.
03/19/2009 13:56:24.261 - Proxy: Created dynamic proxy on port 3011.
03/19/2009 13:56:24.261 - Proxy: Created dynamic proxy on port 3012.
03/19/2009 13:56:24.261 - Proxy: Created dynamic proxy on port 3013.
03/19/2009 13:56:24.261 - Proxy: Created dynamic proxy on port 3014.
03/19/2009 13:56:24.277 - Proxy: Created dynamic proxy on port 3015.
03/19/2009 13:56:24.277 - Proxy: Created dynamic proxy on port 3016.
03/19/2009 13:56:24.277 - Proxy: Created dynamic proxy on port 3017.
03/19/2009 13:56:24.277 - Proxy: Created dynamic proxy on port 3018.
03/19/2009 13:56:24.277 - Proxy: Created dynamic proxy on port 3019.
03/19/2009 13:56:24.277 - Proxy: Created dynamic proxy on port 3020.
03/19/2009 13:56:24.277 - Proxy: Created dynamic proxy on port 3021.
03/19/2009 13:56:24.293 - Proxy: Created dynamic proxy on port 3022.
03/19/2009 13:56:24.293 - Proxy: Created dynamic proxy on port 3023.
03/19/2009 13:56:24.293 - Proxy: Created dynamic proxy on port 3024.
03/19/2009 13:56:24.293 - Proxy: Created dynamic proxy on port 3025.
03/19/2009 13:56:24.293 - Proxy: Created dynamic proxy on port 3026.
03/19/2009 13:56:24.293 - Proxy: Created dynamic proxy on port 3027.
03/19/2009 13:56:24.293 - Proxy: Created dynamic proxy on port 3028.
03/19/2009 13:56:24.308 - Proxy: Created dynamic proxy on port 3029.
03/19/2009 13:56:24.308 - Proxy: Created dynamic proxy on port 3030.
03/19/2009 13:56:24.308 - Proxy: Created dynamic proxy on port 3031.
03/19/2009 13:56:24.308 - Proxy: Created dynamic proxy on port 6510.
03/19/2009 13:56:24.308 - Proxy: Created dynamic proxy on port 6511.
03/19/2009 13:56:24.308 - Proxy: Created dynamic proxy on port 6512.
03/19/2009 13:56:24.308 - Proxy: Created dynamic proxy on port 6513.
03/19/2009 13:56:24.324 - Proxy: Created dynamic proxy on port 6514.
03/19/2009 13:56:24.324 - Proxy: Created dynamic proxy on port 6515.
03/19/2009 13:56:24.324 - Proxy: Created dynamic proxy on port 6516.
03/19/2009 13:56:24.324 - Proxy: Created dynamic proxy on port 6517.
03/19/2009 13:56:24.324 - Proxy: Created dynamic proxy on port 6518.
03/19/2009 13:56:24.324 - Proxy: Created dynamic proxy on port 6519.
03/19/2009 13:56:24.324 - Proxy: Created dynamic proxy on port 6520.
03/19/2009 13:56:24.324 - Proxy: Created dynamic proxy on port 6521.
03/19/2009 13:56:24.340 - Proxy: Created dynamic proxy on port 6522.
03/19/2009 13:56:24.340 - Proxy: Created dynamic proxy on port 6523.
03/19/2009 13:56:24.340 - Proxy: Created dynamic proxy on port 6524.
03/19/2009 13:56:24.340 - Proxy: Created dynamic proxy on port 6525.
03/19/2009 13:56:24.340 - Proxy: Created dynamic proxy on port 6526.
03/19/2009 13:56:24.340 - Proxy: Created dynamic proxy on port 6527.
03/19/2009 13:56:24.340 - Proxy: Created dynamic proxy on port 6528.
03/19/2009 13:56:24.355 - Proxy: Created dynamic proxy on port 6529.
03/19/2009 13:56:24.355 - Proxy: Created dynamic proxy on port 6530.
03/19/2009 13:56:24.355 - Proxy: Created dynamic proxy on port 6531.
03/19/2009 13:56:24.355 - Proxy: Created dynamic proxy on port 6532.
03/19/2009 13:56:24.355 - Proxy: Created dynamic proxy on port 6533.
03/19/2009 13:56:24.355 - Proxy: Created dynamic proxy on port 6534.
03/19/2009 13:56:24.355 - Proxy: Created dynamic proxy on port 6535.
03/19/2009 13:56:24.371 - Proxy: Created dynamic proxy on port 6536.
03/19/2009 13:56:24.371 - Proxy: Created dynamic proxy on port 6537.
03/19/2009 13:56:24.371 - Proxy: Created dynamic proxy on port 6538.
03/19/2009 13:56:24.371 - Proxy: Created dynamic proxy on port 6539.
03/19/2009 13:56:24.371 - Proxy: Created dynamic proxy on port 6540.
03/19/2009 13:56:24.371 - Proxy: Created dynamic proxy on port 6541.
03/19/2009 13:56:24.371 - Proxy: Created dynamic proxy on port 1026.
03/19/2009 13:56:27.840 - TCP: ....S., 192.168.55.101(1035) => 192.168.55.100(7438) Seq=12347588-12347588 Ack=0 Win=32768 Len=48
03/19/2009 13:56:27.840 - Proxy: Connection Attempt on port 7438, dest ip 0x6437a8c0
03/19/2009 13:56:27.840 - TCP: .A..S., 192.168.55.100(7438) => 192.168.55.101(1035) Seq=17445625-17445625 Ack=12347589 Win=8760 Len=44
03/19/2009 13:56:27.933 - TCP: ....S., 192.168.55.101(1036) => 192.168.55.100(990) Seq=12367730-12367730 Ack=0 Win=32768 Len=48
03/19/2009 13:56:27.933 - Proxy: Connection Attempt on port 990, dest ip 0x6437a8c0
03/19/2009 13:56:27.949 - TCP: .A..S., 192.168.55.100(990) => 192.168.55.101(1036) Seq=17445734-17445734 Ack=12367731 Win=8760 Len=44
03/19/2009 13:56:28.824 - CesProxy: Accept on port 7438, IsWinsock 0, hResult 0
03/19/2009 13:56:28.824 - CesProxy: Accept on port 990, IsWinsock 0, hResult 0
03/19/2009 13:56:28.918 - TCP: ....S., 192.168.55.101(1037) => 192.168.55.100(990) Seq=12668475-12668475 Ack=0 Win=32768 Len=48
03/19/2009 13:56:28.933 - TCP: .A..S., 192.168.55.100(990) => 192.168.55.101(1037) Seq=17446718-17446718 Ack=12668476 Win=8760 Len=44
03/19/2009 13:56:29.918 - CesProxy: Accept on port 990, IsWinsock 0, hResult 0
03/19/2009 13:56:29.918 - TCP: ....S., 192.168.55.101(1039) => 192.168.55.100(990) Seq=12958012-12958012 Ack=0 Win=32768 Len=48
03/19/2009 13:56:29.918 - TCP: .A..S., 192.168.55.100(990) => 192.168.55.101(1039) Seq=17447703-17447703 Ack=12958013 Win=8760 Len=44
03/19/2009 13:56:31.011 - CesProxy: Accept on port 990, IsWinsock 0, hResult 0
03/19/2009 13:56:31.027 - TCP: ....S., 192.168.55.101(1040) => 192.168.55.100(990) Seq=13270839-13270839 Ack=0 Win=32768 Len=48
03/19/2009 13:56:31.027 - TCP: .A..S., 192.168.55.100(990) => 192.168.55.101(1040) Seq=17448812-17448812 Ack=13270840 Win=8760 Len=44
03/19/2009 13:56:31.027 - CesProxy: Accept on port 990, IsWinsock 0, hResult 0
////////////////////////////////////Serial to Rndis @WCESCOMM.log
03/19/2009 13:58:09.806 - UsbComm: Change DTR to 0.
03/19/2009 13:58:09.806 - UsbComm: Closed device.
03/19/2009 13:58:09.806 - Proxy: Change connection state 0.
03/19/2009 13:58:09.806 - CesProxy: Close PPP socket 990
03/19/2009 13:58:09.821 - CesProxy: Accept on port 990, IsWinsock 0, hResult 80072714
03/19/2009 13:58:09.821 - CesProxy: Close PPP socket 7438
03/19/2009 13:58:09.821 - CesProxy: Accept on port 7438, IsWinsock 0, hResult 80072714
03/19/2009 13:58:09.821 - CesProxy: Close Win socket 1026
03/19/2009 13:58:09.821 - CesProxy: Accept on port 1026, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.821 - CesProxy: Close Win socket 6541
03/19/2009 13:58:09.821 - CesProxy: Accept on port 6541, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.837 - CesProxy: Close Win socket 6540
03/19/2009 13:58:09.837 - CesProxy: Accept on port 6540, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.837 - USB: Event 32772, name \\?\USB#Vid_05e0&Pid_2000#2f5b1900-11fe-0801-4d4f-303937303863#{25dbce51-6c8f-4a72-8a6d-b54c2b4fc835}
03/19/2009 13:58:09.837 - CesProxy: Close Win socket 6539
03/19/2009 13:58:09.852 - USB: Device Remove Complete notification
03/19/2009 13:58:09.852 - CesProxy: Accept on port 6539, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.852 - CesProxy: Close Win socket 6538
03/19/2009 13:58:09.852 - CesProxy: Accept on port 6538, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.852 - CesProxy: Close Win socket 6537
03/19/2009 13:58:09.852 - CesProxy: Accept on port 6537, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.852 - CesProxy: Close Win socket 6536
03/19/2009 13:58:09.868 - CesProxy: Accept on port 6536, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.868 - CesProxy: Close Win socket 6535
03/19/2009 13:58:09.868 - CesProxy: Accept on port 6535, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.868 - CesProxy: Close Win socket 6534
03/19/2009 13:58:09.868 - CesProxy: Accept on port 6534, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.868 - CesProxy: Close Win socket 6533
03/19/2009 13:58:09.868 - CesProxy: Accept on port 6533, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.884 - CesProxy: Close Win socket 6532
03/19/2009 13:58:09.884 - CesProxy: Accept on port 6532, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.884 - CesProxy: Close Win socket 6531
03/19/2009 13:58:09.884 - CesProxy: Accept on port 6531, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.884 - CesProxy: Close Win socket 6530
03/19/2009 13:58:09.884 - CesProxy: Accept on port 6530, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.884 - CesProxy: Close Win socket 6529
03/19/2009 13:58:09.899 - CesProxy: Accept on port 6529, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.899 - CesProxy: Close Win socket 6528
03/19/2009 13:58:09.899 - CesProxy: Accept on port 6528, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.899 - CesProxy: Close Win socket 6527
03/19/2009 13:58:09.899 - CesProxy: Accept on port 6527, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.899 - CesProxy: Close Win socket 6526
03/19/2009 13:58:09.899 - CesProxy: Accept on port 6526, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.915 - CesProxy: Close Win socket 6525
03/19/2009 13:58:09.915 - CesProxy: Accept on port 6525, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.915 - CesProxy: Close Win socket 6524
03/19/2009 13:58:09.915 - CesProxy: Accept on port 6524, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.915 - CesProxy: Close Win socket 6523
03/19/2009 13:58:09.915 - CesProxy: Accept on port 6523, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.915 - CesProxy: Close Win socket 6522
03/19/2009 13:58:09.915 - CesProxy: Accept on port 6522, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.915 - CesProxy: Close Win socket 6521
03/19/2009 13:58:09.931 - CesProxy: Accept on port 6521, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.931 - CesProxy: Close Win socket 6520
03/19/2009 13:58:09.931 - CesProxy: Accept on port 6520, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.931 - CesProxy: Close Win socket 6519
03/19/2009 13:58:09.931 - CesProxy: Accept on port 6519, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.931 - CesProxy: Close Win socket 6518
03/19/2009 13:58:09.931 - CesProxy: Accept on port 6518, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.931 - CesProxy: Close Win socket 6517
03/19/2009 13:58:09.946 - CesProxy: Accept on port 6517, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.946 - CesProxy: Close Win socket 6516
03/19/2009 13:58:09.946 - CesProxy: Accept on port 6516, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.946 - CesProxy: Close Win socket 6515
03/19/2009 13:58:09.946 - CesProxy: Accept on port 6515, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.946 - CesProxy: Close Win socket 6514
03/19/2009 13:58:09.946 - CesProxy: Accept on port 6514, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.946 - CesProxy: Close Win socket 6513
03/19/2009 13:58:09.946 - CesProxy: Accept on port 6513, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.962 - CesProxy: Close Win socket 6512
03/19/2009 13:58:09.962 - CesProxy: Accept on port 6512, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.962 - CesProxy: Close Win socket 6511
03/19/2009 13:58:09.962 - CesProxy: Accept on port 6511, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.962 - CesProxy: Close Win socket 6510
03/19/2009 13:58:09.962 - CesProxy: Accept on port 6510, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.977 - CesProxy: Close Win socket 3031
03/19/2009 13:58:09.977 - CesProxy: Accept on port 3031, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.977 - CesProxy: Close Win socket 3030
03/19/2009 13:58:09.977 - CesProxy: Accept on port 3030, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.977 - CesProxy: Close Win socket 3029
03/19/2009 13:58:09.977 - CesProxy: Accept on port 3029, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.977 - CesProxy: Close Win socket 3028
03/19/2009 13:58:09.977 - CesProxy: Accept on port 3028, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.993 - CesProxy: Close Win socket 3027
03/19/2009 13:58:09.993 - CesProxy: Accept on port 3027, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.993 - CesProxy: Close Win socket 3026
03/19/2009 13:58:09.993 - CesProxy: Accept on port 3026, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.993 - CesProxy: Close Win socket 3025
03/19/2009 13:58:09.993 - CesProxy: Accept on port 3025, IsWinsock 1, hResult 80072714
03/19/2009 13:58:09.993 - CesProxy: Close Win socket 3024
03/19/2009 13:58:10.009 - CesProxy: Accept on port 3024, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.009 - CesProxy: Close Win socket 3023
03/19/2009 13:58:10.009 - CesProxy: Accept on port 3023, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.009 - CesProxy: Close Win socket 3022
03/19/2009 13:58:10.009 - CesProxy: Accept on port 3022, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.009 - CesProxy: Close Win socket 3021
03/19/2009 13:58:10.024 - CesProxy: Accept on port 3021, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.024 - CesProxy: Close Win socket 3020
03/19/2009 13:58:10.024 - CesProxy: Accept on port 3020, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.024 - CesProxy: Close Win socket 3019
03/19/2009 13:58:10.024 - CesProxy: Accept on port 3019, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.024 - CesProxy: Close Win socket 3018
03/19/2009 13:58:10.024 - CesProxy: Accept on port 3018, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.040 - CesProxy: Close Win socket 3017
03/19/2009 13:58:10.040 - CesProxy: Accept on port 3017, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.040 - CesProxy: Close Win socket 3016
03/19/2009 13:58:10.040 - CesProxy: Accept on port 3016, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.040 - CesProxy: Close Win socket 3015
03/19/2009 13:58:10.040 - CesProxy: Accept on port 3015, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.040 - CesProxy: Close Win socket 3014
03/19/2009 13:58:10.040 - CesProxy: Accept on port 3014, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.056 - CesProxy: Close Win socket 3013
03/19/2009 13:58:10.056 - CesProxy: Accept on port 3013, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.056 - CesProxy: Close Win socket 3012
03/19/2009 13:58:10.056 - CesProxy: Accept on port 3012, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.056 - CesProxy: Close Win socket 3011
03/19/2009 13:58:10.056 - CesProxy: Accept on port 3011, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.056 - CesProxy: Close Win socket 3010
03/19/2009 13:58:10.056 - CesProxy: Accept on port 3010, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.071 - CesProxy: Close Win socket 3009
03/19/2009 13:58:10.071 - CesProxy: Accept on port 3009, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.071 - CesProxy: Close Win socket 3008
03/19/2009 13:58:10.071 - CesProxy: Accept on port 3008, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.071 - CesProxy: Close Win socket 3007
03/19/2009 13:58:10.071 - CesProxy: Accept on port 3007, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.071 - CesProxy: Close Win socket 3006
03/19/2009 13:58:10.071 - CesProxy: Accept on port 3006, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.087 - CesProxy: Close Win socket 3005
03/19/2009 13:58:10.087 - CesProxy: Accept on port 3005, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.087 - CesProxy: Close Win socket 3004
03/19/2009 13:58:10.087 - CesProxy: Accept on port 3004, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.087 - CesProxy: Close Win socket 3003
03/19/2009 13:58:10.087 - CesProxy: Accept on port 3003, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.087 - CesProxy: Close Win socket 3002
03/19/2009 13:58:10.087 - CesProxy: Accept on port 3002, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.087 - CesProxy: Close Win socket 3001
03/19/2009 13:58:10.102 - CesProxy: Accept on port 3001, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.102 - CesProxy: Close Win socket 3000
03/19/2009 13:58:10.102 - CesProxy: Accept on port 3000, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.102 - CesProxy: Close Win socket 5655
03/19/2009 13:58:10.102 - CesProxy: Accept on port 5655, IsWinsock 1, hResult 80072714
03/19/2009 13:58:10.102 - CesProxy: Close PPP socket 990
03/19/2009 13:58:10.102 - CesProxy: recv failed on PPP socket 990, err = 10053
03/19/2009 13:58:10.102 - CesProxy: Close Win socket 990
03/19/2009 13:58:10.102 - CesProxy: recv failed on Win socket 990, err = 10053
03/19/2009 13:58:10.118 - CesProxy: Close PPP socket 990
03/19/2009 13:58:10.118 - CesProxy: recv failed on PPP socket 990, err = 10053
03/19/2009 13:58:10.118 - CesProxy: Close Win socket 990
03/19/2009 13:58:10.118 - CesProxy: recv failed on Win socket 990, err = 10053
03/19/2009 13:58:10.118 - CesProxy: Close PPP socket 990
03/19/2009 13:58:10.118 - CesProxy: recv failed on PPP socket 990, err = 10053
03/19/2009 13:58:10.118 - CesProxy: Close Win socket 990
03/19/2009 13:58:10.118 - CesProxy: recv failed on Win socket 990, err = 10053
03/19/2009 13:58:10.118 - CesProxy: Close PPP socket 990
03/19/2009 13:58:10.134 - CesProxy: recv failed on PPP socket 990, err = 10053
03/19/2009 13:58:10.134 - CesProxy: Close Win socket 990
03/19/2009 13:58:10.134 - CesProxy: recv failed on Win socket 990, err = 10053
03/19/2009 13:58:10.134 - CesProxy: Close PPP socket 7438
03/19/2009 13:58:10.134 - CesProxy: recv failed on PPP socket 7438, err = 10053
03/19/2009 13:58:10.134 - CesProxy: Close Win socket 7438
03/19/2009 13:58:10.134 - CesProxy: recv failed on Win socket 7438, err = 10053
03/19/2009 13:58:10.243 - USB: RNDIS device id \\?\USB#Vid_05e0&Pid_2000#2f5b1900-11fe-0801-4d4f-303937303863#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
03/19/2009 13:58:11.931 - USB: RNDIS device id \\?\USB#Vid_05e0&Pid_200d#2f5b1900-11fe-0801-4d4f-303937303863#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
03/19/2009 13:58:12.087 - USB: found RNDIS device id USB\Vid_05e0&Pid_200d&Rev_0000
03/19/2009 13:58:20.493 - USB RNDIS: Device Arrival notification
////////////////////////////////RNDIS to SErial @WCESMgr
03/19/2009 14:01:32.122 **************** Logging Started ****************
03/19/2009 14:01:32.122 Process C:\Program Files\Microsoft ActiveSync\WCESMgr.exe p(3032)
03/19/2009 14:01:32.122 ActiveSync second instance started, Cmd line: '/onconnect'
03/19/2009 14:01:32.122 ActiveSync second instance exiting
03/19/2009 14:01:32.122 **************** Logging Stopped ****************
03/19/2009 14:01:34.153 Creating new partnership for device 0x0 (Pocket_PC, PocketPC).
03/19/2009 14:01:35.481 p(3472) t(2672) TraceToFile -> ERROR in CCSP::ParseNodes : hr = 0x80140507 - Devicecm.cpp(1598)
03/19/2009 14:01:35.481 Found PIM at 'C:\PROGRA~1\MICROS~3\Office12\OUTLOOK.EXE'
03/19/2009 14:01:35.481 Found PIM at 'C:\PROGRA~1\MICROS~3\Office12\OUTLOOK.EXE'
03/19/2009 14:01:37.981 DTPT: Setting DTPT network to {18AD9FBD-F716-ACB6-FD8A-1965DB95B814}
03/19/2009 14:01:37.981 DTPT: Incomming proxy server string: proxy.iec2.iac:80
03/19/2009 14:01:37.981 DTPT: Setup proxy to send to server. Src={18AD9FBD-F716-ACB6-FD8A-1965DB95B814} Dest={436EF144-B4FB-4863-A041-8F905A62C572} Proxy=proxy.iec2.iac:80 Socks=proxy.iec2.iac:1080 HR=0x00000000
03/19/2009 14:01:37.981 DTPT: Send DTPT Network={18AD9FBD-F716-ACB6-FD8A-1965DB95B814}. Result=0x00000000
03/19/2009 14:01:37.981 DTPTMultiHoming: Send Value=0 Result=0x00000000
//////////////////////////////Serial to RNDIS @WCESMgr
03/19/2009 14:03:12.770 **************** Logging Started ****************
03/19/2009 14:03:12.770 Process C:\Program Files\Microsoft ActiveSync\WCESMgr.exe p(4468)
03/19/2009 14:03:12.770 ActiveSync second instance started, Cmd line: '/onconnect'
03/19/2009 14:03:12.770 ActiveSync second instance exiting
03/19/2009 14:03:12.770 **************** Logging Stopped ****************
03/19/2009 14:03:13.223 Creating new partnership for device 0x0 (Pocket_PC, PocketPC).
03/19/2009 14:03:14.270 p(3472) t(4796) TraceToFile -> ERROR in CCSP::ParseNodes : hr = 0x80140507 - Devicecm.cpp(1598)
03/19/2009 14:03:14.270 Found PIM at 'C:\PROGRA~1\MICROS~3\Office12\OUTLOOK.EXE'
03/19/2009 14:03:14.270 Found PIM at 'C:\PROGRA~1\MICROS~3\Office12\OUTLOOK.EXE'
03/19/2009 14:03:15.910 DTPT: Setting DTPT network to {18AD9FBD-F716-ACB6-FD8A-1965DB95B814}
03/19/2009 14:03:15.910 DTPT: Incomming proxy server string: proxy.iec2.iac:80
03/19/2009 14:03:15.910 DTPT: Setup proxy to send to server. Src={18AD9FBD-F716-ACB6-FD8A-1965DB95B814} Dest={436EF144-B4FB-4863-A041-8F905A62C572} Proxy=proxy.iec2.iac:80 Socks=proxy.iec2.iac:1080 HR=0x00000000
第一章 Device driver 的介紹
免費的OS,像Linux, 的眾多優點之一就是code 都是開放的.
OS, 一個黑暗又神祕的領域,這個領域總是被掌握在少數幾位工程師身上,如今可以容易的被任何有能力的人,檢視、了解及修改.
Linux 已經成為大眾化的OS.
Linux kernel 總是很複雜的,對於那些想要成為kernel 專家的人,需要一個起點來了解kernel是比較容易的,而通常這個點就是device drivers.
在Linux kernel 裡 Device drivers 扮演了一個特別的角色.
它們跟所謂的"黑盒子"不同,它們讓一個特定的硬體對應到定義的好的內部程式介面; 它們能夠完全的穩藏硬體的動作。
上層的使用者可以在一系列標準的function calls 上運作,而每一個function call 則是對印到獨立的且特定的硬體; 這也就是device driver所做的事。
這個programming interface 可以分別build. 當需要時只要 "plugged in"就可. 即使是在rumtmie的時候。
在這樣的模組化情況下,linux drivers 就很容易的去寫它。到目前為止已有幾百個drivers 可用了.
有很多理由讓你對設計Linux device drivers 有興趣 。
硬體不斷的出新換舊,更顯示出可預期的未來,driver 工程師們會一直很忙。
他們需要了解drivers ,才能對他們有興趣的device,進行存取
讓想要支援Linux的硬體製造商,可以將那些使用Linux 的人,加入他們的潛在市場。
而Linux 系統的opensource意謂著driver source 可以快速的散播給幾百萬人,如果driver設計師希望的話。
這本書教你如何寫你的driver,以及如何處理跟它有關的kernel 部份。
我們已經採用裝置獨立的方式;程式技巧和介面都不需要跟任何特定的device 綁在一起。
每個driver 都不同; 身為driver 設計者必需要了解你的device.
不過對所以的drivers來說,大部份的原則和基本技巧是一樣的。這本書沒辦法告訴你,關於你的device的東西,但可以告訴你如何讓你的device動起來,所需的背景知識
Device driver 的角色
身為程式設計師,你能夠選擇你的driver, 也能夠在程式需完成的時間及靈活性之中做一個折衷的選擇。
雖然說driver 是靈活的很奇怪,但是我們喜歡這個字眼,因為這强調了device driver 是一個可以"提供"的機制而不是個方法。
機制和方針之間的不同正是Unix 設計的背後最好的idea.
大部份設計的問題,可以正好分成兩個部份:"什麼樣的能力可以被提供"(機制)和"哪些能力如何被使用"(方針)
如果這兩個問題被提出來在同一個程式不同的部份,或甚至完全不同的程式,那程式就很容易去研發也容易去適應特定的需求。
舉例來說,Unix 的圖形顯示管理就分X server(知道硬體也提供一個統一的介面給用的程式)和window, 還有session managers(實現了一個特定的方法在不知道硬體的情形下)。
人們可以用一樣的window manager 在不同的硬體上跑,或者是不同的user 可以跑不同的組態在同一個workstation。
或甚至完全不同的桌面環境,像是KDE和GNOME,可以共存在同一個系統。
另一個例子是TCP/IP 網路的分層架構: 當不同的server再提供服務時(提供和何傳送資料的方法),作業系統就有提供socket抽像層(不提供任何方法跟被傳送的資料有關)
還有,像FTP 這樣的server 有提供檔案傳輸的機制,但是無論使用者用什麼介面都可用這個機制;command-line 和繪圖介面都可同時存在,並且任何人都可以寫個新的介面來傳送檔案
那drivers 要關切的,就是the same separation of mechanism and policy applies
軟碟 driver 不提供任何方法-它的角色就是只有顯示一個連續資料的陣列。而上層的系統則提供方法來讓任何人直接存取軟碟或通過檔案系統。
一但在不同的環境下,用不同的方式,經常使用硬體,driver盡可能的不限制使用方法,就顯的很重要。
當要設計drivers時,設計者們應該要特別注意這個重要的觀念: 寫一個在kernel的程式,來存取硬體,而不是要求使用者用特定的方法來用你的硬體,因為不同的使用者有不同的需要。
driver 應該要讓硬體可以被使用,而不要管應用程式要如何使用硬體
然後driver也要夠靈活,如果它提供個能力來無限制的使用硬體
然而,有時候有些方法是要被確定的。例如,一個數位I/O driver可能只提供byte-wide 的存取,來存取硬體來避免要額外的程式來處理獨立的bits
你也可以用不同的觀點來看你的driver: 它是一個軟體躺在應用程式跟實體device 的中間。
對於一個扮演有特權的角色的driver來說,允許driver 設計者可以決定device 要如何見人: 甚至於同一個device,可以有不同的drivers來提供不同的能力。
實際的driver設計應該要在許多不同的顧慮中取得平衡。舉例來說,一個單一的device可能同時被不同的程式使用,而driver 的設計者有完全的自由來決定如何處理這樣的同時發生的情況。
你可以寫個記憶體對映到一個完全跟硬體無關的device,或者你也可以提供一個user library 來幫助應用程式的設計者在可用的原素上寫些新的方法來使用,等等。
一個主要的考量就是,不但要在盡可能的給user選擇的權利和完成driver所需的時間中取得妥協,還要讓它簡單,以致於錯誤數量不會一直的上升。
不含使用方法的driver 有很多特性。像是同步和非同步的運作,可以被開啟很多次,可以被盡情的使用,或是沒有軟體層讓它很簡單,或提供有特定方法的運作。
這種特性的drivers 不只對end usres來說很好用,也容易來撰寫及維護。像這樣的不限制使用方法的driver 其實是軟體設計者的共同目標。
透過使用者的程式幫助設定並存取目標的device,確實許多device drivers 是互相關連在一起的.
這些程式可以將簡單的工具延申到一個完整的圖形應用程式。
tunelp 程式就是個例子,它是用來調節並列port(印表機的運作),及繪圖 cardctl 系統工具(PCMCIA driver 包的一部份)。像client library 也是經常被提供,這樣的library 就提供了一些不需要在driver 裡寫的一些功能
這本書是範疇在kernel,所以我們試著不要處理applicantion如何用的問題或是支援資料庫。有時我們會討論到不同的方法和如何支援他們,但我們不會太仔細的討論程式如何使用device,或是他們實施什麼樣的方法。然而,你需要了解,使用者程式是整個軟體組件的一部份,就算是(不含使用方法)的組件也是有設定檔,來設定預設的行為來實現基本的的機制。