このチュートリアルを使用して、単純な linux char デバイス ドライバーを作成しようとしました。 /
少し新しいデバイスと少し新しいカーネルを使用しています。そのため、製品とベンダーIDを変更するコードを使用しました.デバイスが接続されているときにカーネルコールプローブ機能を作成しようとしていますが、/var/log/messagesを見て失敗しました. ドライバーは正常にロードされます:
Sep 5 18:32:43 manticore kernel: [10673.664884] usbcore: deregistering interface driver missile_launcher
Sep 5 18:32:43 manticore kernel: [10673.664908] [info] usb_ml_exit(661): module deregistered
Sep 5 18:32:43 manticore kernel: [10673.666314] usbcore: registered new interface driver missile_launcher
Sep 5 18:32:43 manticore kernel: [10673.666317] [info] usb_ml_init(651): driver registered successfully
ただし、デバイスが接続されている場合、ドライバーは使用されません。
Sep 5 17:58:12 manticore kernel: [ 8607.295688] usb 3-1.1: New USB device found, idVendor=2123, idProduct=1010
Sep 5 17:58:12 manticore kernel: [ 8607.295689] usb 3-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Sep 5 17:58:12 manticore kernel: [ 8607.295691] usb 3-1.1: Product: USB Missile Launcher
Sep 5 17:58:12 manticore kernel: [ 8607.295693] usb 3-1.1: Manufacturer: Syntek
Sep 5 17:58:12 manticore kernel: [ 8607.295789] usb 3-1.1: usb_probe_device
Sep 5 17:58:12 manticore kernel: [ 8607.295791] usb 3-1.1: configuration #1 chosen from 1 choice
Sep 5 17:58:12 manticore kernel: [ 8607.295797] usb 3-1.1: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
Sep 5 17:58:12 manticore kernel: [ 8607.295855] usb 3-1.1: Successful Endpoint Configure command
Sep 5 17:58:12 manticore kernel: [ 8607.296132] usb 3-1.1: adding 3-1.1:1.0 (config #1, interface 0)
Sep 5 17:58:12 manticore kernel: [ 8607.296173] usbhid 3-1.1:1.0: usb_probe_interface
Sep 5 17:58:12 manticore kernel: [ 8607.296174] usbhid 3-1.1:1.0: usb_probe_interface - got id
Sep 5 17:58:12 manticore kernel: [ 8607.298577] usbhid 3-1.1:1.0: looking for a minor, starting at 96
Sep 5 17:58:12 manticore kernel: [ 8607.298697] generic-usb 0003:2123:1010.0008: hiddev0,hidraw2: USB HID v1.10 Device [Syntek USB Missile Launcher] on usb-0000:00:14.0-1.1/input0
Sep 5 17:58:12 manticore kernel: [ 8607.298712] drivers/usb/core/inode.c: creating file '016'
Sep 5 17:58:12 manticore kernel: [ 8607.298754] hub 3-1:1.0: port 2, status 0101, change 0000, 12 Mb/s
Sep 5 17:58:12 manticore kernel: [ 8607.310627] hub 3-1:1.0: port 2 not reset yet, waiting 10ms
Sep 5 17:58:12 manticore kernel: [ 8607.372509] usb 3-1.2: new high-speed USB device number 17 using xhci_hcd
Sep 5 17:58:12 manticore kernel: [ 8607.418456] usb 3-1.2: skipped 1 descriptor after configuration
Sep 5 17:58:12 manticore kernel: [ 8607.418460] usb 3-1.2: skipped 6 descriptors after interface
Sep 5 17:58:12 manticore kernel: [ 8607.418462] usb 3-1.2: skipped 1 descriptor after endpoint
Sep 5 17:58:12 manticore kernel: [ 8607.418463] usb 3-1.2: skipped 9 descriptors after interface
Sep 5 17:58:12 manticore kernel: [ 8607.419100] usb 3-1.2: default language 0x0409
Sep 5 17:58:12 manticore kernel: [ 8607.421607] usb 3-1.2: udev 17, busnum 3, minor = 272
この関連付けを行う責任があるコードは次のとおりです。
#define ML_VENDOR_ID 0x2123
#define ML_PRODUCT_ID 0x1010
static struct usb_device_id ml_table [] = {
{ USB_DEVICE(ML_VENDOR_ID, ML_PRODUCT_ID) },
{ }
};
static struct usb_driver ml_driver = {
.name = "missile_launcher",
.id_table = ml_table,
.probe = ml_probe,
.disconnect = ml_disconnect,
};
カーネルのバージョンは 3.3.8 です
何が間違っているのでしょうか?
ところで。私はこれにまったく慣れていないので、関連する情報をスキップした可能性が非常に高いので、さらに何か必要な場合はお問い合わせください.