當前位置:首頁 » 操作系統 » 驅動源碼

驅動源碼

發布時間: 2022-01-14 19:59:06

㈠ 如何找到mysql-jdbc驅動源碼

在工程中右鍵新建file,命名為jdbc.properties

創建完畢如圖:

在jdbc.properties文件中輸入如下信息,分別是資料庫的驅動,連接,用戶名和密碼

新建JdbcTest2.java

輸入如下代碼:

代碼說明:
這段代碼是讀取配置文件,把配置文件中的各個項通過名稱讀取出來

這段代碼是通過反射來創建Driver對象,反射就是類的實例化

在主函數中輸入如下,測試方法

運行之後的結果如下,表示連接成功!

㈡ 請問各位大神,做linux驅動移植時,內核沒有的一些外設的驅動源碼一般是去哪裡找呢

linux內核源碼,能支持的驅動已經是很豐富的了。
如果沒有具體型號的外設驅動,那麼,就參考linux內核已有的驅動源碼,來修改。
比如:網卡驅動
A板卡,網路晶元是DM9000,在linux-x.x.x/drivers/net目錄下有dm9000.c驅動;
現在要做網路晶元是CS8900,沒有驅動,就可以參考DM9000驅動,
對照晶元手冊,修改驅動,編譯通過,調試等。

㈢ 怎麼將驅動源代碼編譯進linux系統

一、 驅動程序編譯進內核的步驟
在 linux 內核中增加程序需要完成以下三項工作:
1. 將編寫的源代碼復制到 Linux 內核源代碼的相應目錄;
2. 在目錄的 Kconfig 文件中增加新源代碼對應項目的編譯配置選項;
3. 在目錄的 Makefile 文件中增加對新源代碼的編譯條目。

bq27501驅動編譯到內核中具體步驟如下:
1. 先將驅動代碼bq27501文件夾復制到 ti-davinci/drivers/ 目錄下。
確定bq27501驅動模塊應在內核源代碼樹中處於何處。
設備驅動程序存放在內核源碼樹根目錄 drivers/ 的子目錄下,在其內部,設備驅動文件進一步按照類別,類型等有序地組織起來。
a. 字元設備存在於 drivers/char/ 目錄下
b. 塊設備存放在 drivers/block/ 目錄下
c. USB 設備則存放在 drivers/usb/ 目錄下。
注意:
(1) 此處的文件組織規則並非絕對不變,例如: USB 設備也屬於字元設備,也可以存放在 drivers/usb/ 目錄下。
(2) 在 drivers/char/ 目錄下,在該目錄下同時存在大量的 C 源代碼文件和許多其他目錄。所有對於僅僅只有一兩個源文件的設備驅動程序,可以直接存放在該目錄下,但如果驅動程序包含許多源文件和其他輔助文件,那麼可以創建一個新子目錄。
(3) bq27501的驅動是屬於字元設備驅動類別,雖然驅動相關的文件只有兩個,但是為了方面查看,將相關文件放在了bq27501的文件夾中。在drivers/char/目錄下增加新的設備過程比較簡單,但是在drivers/下直接添加新的設備稍微復雜點。所以下面首先給出在drivers/下添加bq27501驅動的過程,然後再簡單說明在drivers/char/目錄下添加的過程。

2. 在/bq27501下面新建一個Makefile文件。向裡面添加代碼:
obj-$(CONFIG_BQ27501)+=bq27501.o
此時,構建系統運行就將會進入 bq27501/ 目錄下,並且將bq27501.c 編譯為 bq27501.o
3. 在/bq27501下面新建Kconfig文件。添加代碼:
menu "bq27501 driver"

config BQ27501
tristate"BQ27501"
default y
---help---
Say 'Y' here, it will be compiled into thekernel; If you choose 'M', it will be compiled into a mole named asbq27501.ko.
endmenu
注意:help中的文字不能加回車符,否則make menuconfig編譯的時候會報錯。
4. 修改/drivers目錄下的Kconfig文件,在endmenu之前添加一條語句『source drivers/bq27501/Kconfig』 對於驅動程序,Kconfig 通常和源代碼處於同一目錄。 若建立了一個新的目錄,而且也希望 Kconfig 文件存在於該目錄中的話,那麼就必須在一個已存在的 Kconfig 文件中將它引入,需要用上面的語句將其掛接在 drivers 目錄中的Kconfig 中。

5. 修改/drivers目下Makefile文件,添加『obj-$(CONFIG_BQ27501) +=bq27501/』。這行編譯指令告訴模塊構建系統在編譯模塊時需要進入 bq27501/ 子目錄中。此時的驅動程序的編譯取決於一個特殊配置 CONFIG_BQ27501 配置選項。

6. 修改arch/arm目錄下的Kconfig文件,在menu "Device Drivers……endmenu"直接添加語句
source "drivers/bq27501/Kconfig"

㈣ oracle jdbc驅動源代碼

可以用JD-GUI反編譯jar

㈤ linux 驅動程序開發,為什麼要編譯內核源碼樹

您好,這樣的情況建議您下載最新版本的驅動精靈,或是直接在線升級一下驅動精靈。希望可以幫到您。

㈥ 程序高手來!!求驅動程序代碼!!跪謝= =

*

* 與PCI函數進行交互的簡單KLD

*

* Murray Stokely

*/

#include <sys/param.h> /* kernel.h中使用的定義 */

#include <sys/mole.h>

#include <sys/systm.h>

#include <sys/errno.h>

#include <sys/kernel.h> /* 模塊初始化中使用的類型 */

#include <sys/conf.h> /* cdevsw結構 */

#include <sys/uio.h> /* uio結構 */

#include <sys/malloc.h>

#include <sys/bus.h> /* pci匯流排用到的結構、原型 */

#include <machine/bus.h>

#include <sys/rman.h>

#include <machine/resource.h>

#include <dev/pci/pcivar.h> /* 為了使用get_pci宏! */

#include <dev/pci/pcireg.h>

/* softc保存我們每個實例的數據。 */

struct mypci_softc {

device_t my_dev;

struct cdev *my_cdev;

};

/* 函數原型 */

static d_open_t mypci_open;

static d_close_t mypci_close;

static d_read_t mypci_read;

static d_write_t mypci_write;

/* 字元設備入口點 */

static struct cdevsw mypci_cdevsw = {

.d_version = D_VERSION,

.d_open = mypci_open,

.d_close = mypci_close,

.d_read = mypci_read,

.d_write = mypci_write,

.d_name = "mypci",

};

/*

* 在cdevsw常式中,我們通過結構體cdev中的成員si_drv1找出我們的softc。

* 當我們建立/dev項時,在我們的已附著的常式中,

* 我們設置這個變數指向我們的softc。

*/

int

mypci_open(struct cdev *dev, int oflags, int devtype, d_thread_t *td)

{

struct mypci_softc *sc;

/* Look up our softc. */

sc = dev->si_drv1;

device_printf(sc->my_dev, "Opened successfully.\n");

return (0);

}

int

mypci_close(struct cdev *dev, int fflag, int devtype, d_thread_t *td)

{

struct mypci_softc *sc;

/* Look up our softc. */

sc = dev->si_drv1;

device_printf(sc->my_dev, "Closed.\n");

return (0);

}

int

mypci_read(struct cdev *dev, struct uio *uio, int ioflag)

{

struct mypci_softc *sc;

/* Look up our softc. */

sc = dev->si_drv1;

device_printf(sc->my_dev, "Asked to read %d bytes.\n", uio->uio_resid);

return (0);

}

int

mypci_write(struct cdev *dev, struct uio *uio, int ioflag)

{

struct mypci_softc *sc;

/* Look up our softc. */

sc = dev->si_drv1;

device_printf(sc->my_dev, "Asked to write %d bytes.\n", uio->uio_resid);

return (0);

}

/* PCI支持函數 */

/*

* 將某個設置的標識與這個驅動程序支持的標識相比較。

* 如果相符,設置描述字元並返回成功。

*/

static int

mypci_probe(device_t dev)

{

device_printf(dev, "MyPCI Probe\nVendor ID : 0x%x\nDevice ID : 0x%x\n",

pci_get_vendor(dev), pci_get_device(dev));

if (pci_get_vendor(dev) == 0x11c1) {

printf("We've got the Winmodem, probe successful!\n");

device_set_desc(dev, "WinModem");

return (BUS_PROBE_DEFAULT);

}

return (ENXIO);

}

/* 只有當探測成功時才調用連接函數 */

static int

mypci_attach(device_t dev)

{

struct mypci_softc *sc;

printf("MyPCI Attach for : deviceID : 0x%x\n", pci_get_devid(dev));

/* Look up our softc and initialize its fields. */

sc = device_get_softc(dev);

sc->my_dev = dev;

/*

* Create a /dev entry for this device. The kernel will assign us

* a major number automatically. We use the unit number of this

* device as the minor number and name the character device

* "mypci<unit>".

*/

sc->my_cdev = make_dev(&mypci_cdevsw, device_get_unit(dev),

UID_ROOT, GID_WHEEL, 0600, "mypci%u", device_get_unit(dev));

sc->my_cdev->si_drv1 = sc;

printf("Mypci device loaded.\n");

return (0);

}

/* 分離設備。 */

static int

mypci_detach(device_t dev)

{

struct mypci_softc *sc;

/* Teardown the state in our softc created in our attach routine. */

sc = device_get_softc(dev);

destroy_dev(sc->my_cdev);

printf("Mypci detach!\n");

return (0);

}

/* 系統關閉期間在sync之後調用。 */

static int

mypci_shutdown(device_t dev)

{

printf("Mypci shutdown!\n");

return (0);

}

/*

* 設備掛起常式。

*/

static int

mypci_suspend(device_t dev)

{

printf("Mypci suspend!\n");

return (0);

}

/*

* 設備恢復(重新開始)常式。

*/

static int

mypci_resume(device_t dev)

{

printf("Mypci resume!\n");

return (0);

}

static device_method_t mypci_methods[] = {

/* 設備介面 */

DEVMETHOD(device_probe, mypci_probe),

DEVMETHOD(device_attach, mypci_attach),

DEVMETHOD(device_detach, mypci_detach),

DEVMETHOD(device_shutdown, mypci_shutdown),

DEVMETHOD(device_suspend, mypci_suspend),

DEVMETHOD(device_resume, mypci_resume),

{ 0, 0 }

};

static devclass_t mypci_devclass;

DEFINE_CLASS_0(mypci, mypci_driver, mypci_methods, sizeof(struct mypci_softc));

DRIVER_MODULE(mypci, pci, mypci_driver, mypci_devclass, 0, 0);

㈦ 能給我發幾個Linux驅動源碼嗎

有,我發給你 我發給你的郵箱是凡凡<[email protected]>▼

㈧ linux的U盤驅動源碼

根據你的描述,估計FUSE不適合你。

參考以下幾個文件吧(我的系統是DEBIAN LENNY)

localhost:/home/aaa/program# apt-cache search libusb
libusb-0.1-4 - userspace USB programming library
libusb-1.0-0 - userspace USB programming library
libusb-1.0-0-dev - userspace USB programming library development files
libusb-dev - userspace USB programming library development files

用apt-get source libusb下載過來的內如如下所示:
total 1688
-rw-r--r-- 1 500 500 2661 2005-02-14 acinclude.m4
-rw-r--r-- 1 500 500 244051 2006-03-04 aclocal.m4
drwxrwxrwx 2 500 500 4096 2006-03-04 apidocs
-rw-r--r-- 1 500 500 130 2004-04-22 AUTHORS
-rw-r--r-- 1 500 500 16833 2006-03-04 bsd.c
-rw-r--r-- 1 500 500 189 2004-01-28 ChangeLog
-rwxr-xr-x 1 500 500 3642 2004-03-12 compile
-rwxr-xr-x 1 500 500 42037 2004-04-12 config.guess
-rw-r--r-- 1 500 500 2467 2006-03-04 config.h.in
-rwxr-xr-x 1 500 500 30221 2004-04-12 config.sub
-rwxr-xr-x 1 500 500 746195 2006-03-04 configure
-rw-r--r-- 1 500 500 6777 2006-03-04 configure.in
-rw-r--r-- 1 500 500 26428 2004-01-28 COPYING
-rw-r--r-- 1 500 500 35685 2006-03-04 darwin.c
drwxr-xr-x 3 root root 4096 02-19 18:51 debian
-rwxr-xr-x 1 500 500 14841 2004-03-12 depcomp
-rw-r--r-- 1 500 500 15021 2006-03-04 descriptors.c
drwxrwxrwx 2 500 500 4096 02-19 18:49 doc
-rw-r--r-- 1 500 500 44099 2006-03-04 Doxyfile
-rw-r--r-- 1 500 500 44154 2006-02-07 Doxyfile.in
-rw-r--r-- 1 500 500 759 2004-01-28 error.c
-rw-r--r-- 1 500 500 716 2004-01-28 error.h
-rw-r--r-- 1 500 500 2043 2006-03-04 INSTALL.libusb
-rw-r--r-- 1 500 500 2063 2004-01-28 INSTALL.libusb.in
-rwxr-xr-x 1 500 500 9208 2004-03-12 install-sh
-rw-r--r-- 1 500 500 1267 2004-01-28 libusb-config.in
-rw-r--r-- 1 500 500 196 2005-02-15 libusb.pc.in
-rw-r--r-- 1 500 500 1290 2006-03-04 libusb.spec
-rw-r--r-- 1 500 500 1293 2006-03-04 libusb.spec.in
-rw-r--r-- 1 500 500 2248 2004-01-28 LICENSE
-rw-r--r-- 1 500 500 19148 2006-03-04 linux.c
-rw-r--r-- 1 500 500 3146 2005-02-03 linux.h
-rw-r--r-- 1 500 500 183730 2004-04-12 ltmain.sh
-rw-r--r-- 1 500 500 2220 2006-03-04 Makefile.am
-rw-r--r-- 1 500 500 34139 2006-03-04 Makefile.in
-rwxr-xr-x 1 500 500 10678 2004-03-12 missing
-rw-r--r-- 1 500 500 8 2004-01-28 NEWS
-rw-r--r-- 1 500 500 2546 2006-03-04 README
-rw-r--r-- 1 500 500 2556 2006-03-04 README.in
drwxrwxrwx 2 500 500 4096 2006-03-04 tests
-rw-r--r-- 1 500 500 6443 2006-03-04 usb.c
-rw-r--r-- 1 500 500 8367 2006-03-04 usb.h.in
-rw-r--r-- 1 500 500 1771 2006-03-04 usbi.h
-rw-r--r-- 1 500 500 13511 2006-03-04 usbpp.cpp
-rw-r--r-- 1 500 500 24428 2005-02-10 usbpp.h
可以從usb.c, usb.h.in入手來研究。

㈨ window7下如何編寫USB驅動源碼

首先需要把驅動壓縮解壓到一個文件夾
然後找到你桌面的計算機 點右鍵 屬性
然後點設備管理
然後找到你的Apple USB Ethernet Adapter 設備 點右鍵屬性
再點驅動程序 再點下面的更新驅動程序
再點 瀏覽計算機查找驅動程序軟體
然後一步步確定即可。重新啟動,OK!

㈩ 驅動源碼是什麼,是怎麼個概念,麻煩講的通俗點。

就是驅動程序的源程序
編寫驅動程序要先寫出源碼,然後編譯。編譯之前的代碼就是源碼。
你下載的驅動都是經過編譯的,是可執行文件,不是源碼。源碼只有編寫者手裡才有的。

熱點內容
qq系統頭像文件夾 發布:2024-10-18 14:14:55 瀏覽:234
安卓手機請輸入密碼在哪裡 發布:2024-10-18 14:13:28 瀏覽:645
設計編譯程序注意的問題 發布:2024-10-18 14:08:43 瀏覽:254
傳智播客android視頻 發布:2024-10-18 14:04:42 瀏覽:904
手機版安卓吃雞哪個好 發布:2024-10-18 14:01:40 瀏覽:491
編程自學入門教程 發布:2024-10-18 13:50:58 瀏覽:141
伊迪阿明訪問中國 發布:2024-10-18 13:49:54 瀏覽:10
人三琳外傳腳本 發布:2024-10-18 13:38:16 瀏覽:839
電腦發件箱伺服器錯誤怎麼弄 發布:2024-10-18 13:30:36 瀏覽:914
evm部署solc編譯文件 發布:2024-10-18 13:29:47 瀏覽:835