Linux驅動模組載入方法和如何判斷Linux驅動是否載入成功
1.Linux驅動的載入方法:在驅動路徑下 insmod testdiver.ko
2.解除安裝方法:任何路徑下 rmmmod testdiver
3.怎麼判斷驅動是否載入:
3.1進入到根目錄 : find | grep testdiver ,可檢視/dev/testdiver
3.2 進入ls /dev/test* ,可檢視/dev/testdiver
4.再次檢視驅動載入時的除錯資訊:
進入到根目錄 : dmesg | grep testdi*
- 檢視驅動程式的主裝置號:
5.1 cat /proc/devices 應答資訊如下:
1 mem
4 /dev/vc/0
4 tty
4 ttyS
5 /dev/tty
5 /dev/console
5 /dev/ptmx
7 vcs
10 misc
13 input
14 sound
21 sg
29 fb
81 video4linux
89 i2c
90 mtd
108 ppp
116 alsa
128 ptm
136 pts
153 spi
180 usb
189 usb_device
226 drm
245 ms5525_i2c
246 iio
247 media
248 ttySDIO
249 usbmon
250 hci_tty
251 watchdog
252 ptp
253 pps
254 rtc
Block devices:
1 ramdisk
259 blkext
7 loop
8 sd
11 sr
31 mtdblock
顯示系統的所有字元裝置和塊裝置,可在列表中,找到相應的testdiver 和裝置號
5.2 ls /dev -l
應答資訊如下:
drwxr-xr-x 2 root root 780 Sep 16 07:44 block
drwxr-xr-x 3 root root 60 Sep 16 07:44 bus
drwxr-xr-x 2 root root 3180 Sep 16 07:45 char
crw------- 1 root root 5, 1 Sep 16 07:44 console
crw------- 1 root root 10, 61 Sep 15 09:19 cpu_dma_latency
crw-rw-rw- 1 root root 10, 57 Sep 16 07:44 crypto
drwxr-xr-x 6 root root 120 Sep 16 07:44 disk
drwxr-xr-x 2 root root 80 Sep 16 07:44 dri
lrwxrwxrwx 1 root root 3 Sep 16 07:44 fb -> fb0
crw-rw---- 1 root video 29, 0 Sep 15 09:19 fb0
lrwxrwxrwx 1 root root 13 Sep 16 07:44 fd -> /proc/self/fd
crw-rw-rw- 1 root root 1, 7 Sep 15 09:19 full
crw------- 1 root root 250, 0 Sep 16 07:44 hci_tty
crw------- 1 root root 10, 183 Sep 15 09:19 hwrng
crw------- 1 root root 89, 0 Sep 16 07:44 i2c-0
crw------- 1 root root 89, 1 Sep 16 07:44 i2c-1
crw------- 1 root root 89, 2 Sep 16 07:44 i2c-2
可以找到I2C的主裝置號為89 ,次裝置號分別為0 /1/2
6.如果判斷驅動是否載入成功呢?
步驟1- 步驟5必須全部通過,否則說明驅動載入異常,需進一步排查原因
注意:Linux驅動裝置號的分配,主裝置號範圍為1-255 ,驅動編寫過程中如果指定DEVICE_MAJOR=0 ,則系統會自動分配一個主裝置號
相關文章
- Helloworld 驅動模組載入
- Linux核心模組驅動載入與dmesg除錯Linux除錯
- 判斷裝置驅動有沒有被載入的方法
- 載入驅動
- UEFI載入程式 & 驅動模組化
- 判斷img圖片是否載入成功
- windows載入驅動Windows
- 載入驅動三種execute
- windows驅動載入順序Windows
- linux核心動態載入模組Linux
- Linux裝置驅動框架、配置檔案及載入(轉)Linux框架
- Linux驅動開發: Ubuntu(PC機)系統上編譯驅動並載入測試LinuxUbuntu編譯
- Class.forName 如何載入資料庫驅動資料庫
- javascript如何判斷一張圖片是否載入完成JavaScript
- 如何判斷js檔案是否載入完畢JS
- 載入NT驅動的類 C++C++
- 驅動載入到proc檔案下
- JavaScript判斷iframe是否載入完畢JavaScript
- js如何判斷頁面是否已經載入完成JS
- javascript如何判斷一個圖片是否載入完成JavaScript
- js如何判斷<img>圖片是否載入完畢JS
- js如何判斷img圖片是否載入完畢JS
- jquery如何判斷js檔案是否載入完畢jQueryJS
- OrchardCore 如何動態載入模組?
- Windows10系統載入ahci驅動程式的方法Windows
- 編寫軟體動態載入NT式驅動
- 【linux】驅動-2-核心模組Linux
- MySQL驅動的下載方法MySql
- linux驅動之LED驅動Linux
- linux裝置驅動編寫入門Linux
- 如何判斷一個img圖片是否載入完畢
- 應用層和驅動如何判斷當前的啟動模式模式
- Linux的input輸入子系統:裝置驅動之按鍵驅動Linux
- 自己動手寫Web自動化測試框架(5):判斷瀏覽器是否載入完成Web框架瀏覽器
- Linux系統核心模組和驅動的編寫(轉)Linux
- AntSK 0.2.1 版本揭秘:動態載入dll,驅動Function Call新境界!Function
- 如何向 Linux 核心提交驅動Linux
- Linux驅動入門基礎基礎知識Linux