Linux-Kernel

找到合適的設備進行逆向工程

  • May 19, 2019

我有一個華碩 GL503VD,它的觸摸板在 linux 上不起作用。

我嘗試了許多不同的發行版:Arch、Debian、Ubuntu 16/17/18、Sabayon、Pop_OS、Fedora。他們都沒有讓觸摸板工作,所以我選擇了 Ubuntu 18.04 並決定自己調試它。

首先,這台筆記型電腦非常新,因此如果沒有 acpi=force GRUB 參數,它將無法啟動。其次,如果允許載入模組 i2c-hid,它將啟動到黑屏(所以我不得不將 i2c-hid 列入黑名單)。我很確定 i2c-hid 是應該照顧我的觸摸板的驅動程序,所以這可能是一個值得研究的問題。問題是當允許載入模組時,我什至無法使用 ctrl+alt+f* 組合到達終端,它只是黑色,虛無。

從我的 Windows 分區中,我可以看出觸摸板是 ELAN1200(不是 elantech)。我嘗試載入模組 hid-elan 沒有任何成功。出於絕望,我也嘗試了突觸模組,但沒有任何運氣。嘗試了各種 x.org.conf.d 配置,這些配置只能阻止我的筆記型電腦訪問 Gnome DE。嘗試使用libinput,徒勞無功。

試過i8042.nomux=1,i8042.noloop,i8042.nopnp,i8042.kdbreset=1,i8042.reset;這些都不起作用。(據我所知,我的觸摸板/鍵盤組合可能由 i8042 晶片管理;雖然從 xinput 輸出看起來更像是 ITE8910 管理組合。)

xinput 輸出也告訴我觸摸板可能是觸摸板/鍵盤組合的一部分。我認為觸摸板和鍵盤是一個設備:ITE8910

x輸入輸出:

⎡ Virtual core pointer                          id=2    [master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer                id=4    [slave  pointer  (2)]
⎜   ↳ MOSART Semi. USB Device                   id=12   [slave  pointer  (2)]
⎜   ↳ ITE Tech. Inc. ITE Device(8910)           id=14   [slave  pointer  (2)]
⎣ Virtual core keyboard                         id=3    [master keyboard (2)]
   ↳ Virtual core XTEST keyboard               id=5    [slave  keyboard (3)]
   ↳ Power Button                              id=6    [slave  keyboard (3)]
   ↳ Asus Wireless Radio Control               id=7    [slave  keyboard (3)]
   ↳ Video Bus                                 id=8    [slave  keyboard (3)]
   ↳ Video Bus                                 id=9    [slave  keyboard (3)]
   ↳ Power Button                              id=10   [slave  keyboard (3)]
   ↳ Sleep Button                              id=11   [slave  keyboard (3)]
   ↳ USB2.0 HD UVC WebCam: USB2.0 HD           id=13   [slave  keyboard (3)]
   ↳ Asus WMI hotkeys                          id=15   [slave  keyboard (3)]
   ↳ AT Translated Set 2 keyboard              id=16   [slave  keyboard (3)]
   ↳ ITE Tech. Inc. ITE Device(8910)           id=17   [slave  keyboard (3)]

dmesg 的輸出告訴我設備是通過 USB 連接的:

[    2.408602] usb 1-8: new full-speed USB device number 5 using xhci_hcd
[    2.562105] usb 1-8: New USB device found, idVendor=0b05, idProduct=1869
[    2.562106] usb 1-8: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.562107] usb 1-8: Product: ITE Device(8910)
[    2.562108] usb 1-8: Manufacturer: ITE Tech. Inc.

如果我 lsusb 我看到帶有供應商 ID 和產品 ID 的正確設備:

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 0b05:1869 ASUSTek Computer, Inc. 
Bus 001 Device 004: ID 13d3:5666 IMC Networks 
Bus 001 Device 003: ID 8087:0a2b Intel Corp. 
Bus 001 Device 002: ID 062a:410c Creative Labs 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

注意:Creative Labs 設備是外接滑鼠。

當我 lsusb -vd 0b05:1869 時,我只看到與鍵盤相關的描述符:

Bus 001 Device 005: ID 0b05:1869 ASUSTek Computer, Inc. 
Device Descriptor:
 bLength                18
 bDescriptorType         1
 bcdUSB               2.00
 bDeviceClass            0 (Defined at Interface level)
 bDeviceSubClass         0 
 bDeviceProtocol         0 
 bMaxPacketSize0        64
 idVendor           0x0b05 ASUSTek Computer, Inc.
 idProduct          0x1869 
 bcdDevice            0.03
 iManufacturer           1 ITE Tech. Inc.
 iProduct                2 ITE Device(8910)
 iSerial                 0 
 bNumConfigurations      1
 Configuration Descriptor:
   bLength                 9
   bDescriptorType         2
   wTotalLength           34
   bNumInterfaces          1
   bConfigurationValue     1
   iConfiguration          0 
   bmAttributes         0xe0
     Self Powered
     Remote Wakeup
   MaxPower              100mA
   Interface Descriptor:
     bLength                 9
     bDescriptorType         4
     bInterfaceNumber        0
     bAlternateSetting       0
     bNumEndpoints           1
     bInterfaceClass         3 Human Interface Device
     bInterfaceSubClass      1 Boot Interface Subclass
     bInterfaceProtocol      1 Keyboard
     iInterface              0 
       HID Device Descriptor:
         bLength                 9
         bDescriptorType        33
         bcdHID               1.10
         bCountryCode            0 Not supported
         bNumDescriptors         1
         bDescriptorType        34 Report
         wDescriptorLength     263
         Report Descriptor: (length is 263)
           Item(Global): Usage Page, data= [ 0x89 0xff ] 65417
                           (null)
           Item(Local ): Usage, data= [ 0x10 ] 16
                           (null)
           Item(Main  ): Collection, data= [ 0x01 ] 1
                           Application
           Item(Global): Report ID, data= [ 0xa5 ] 165
           Item(Local ): Usage, data= [ 0x01 ] 1
                           (null)
           Item(Global): Logical Minimum, data= [ 0x00 ] 0
           Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
           Item(Global): Report Size, data= [ 0x08 ] 8
           Item(Global): Report Count, data= [ 0x10 ] 16
           Item(Main  ): Feature, data= [ 0x00 ] 0
                           Data Array Absolute No_Wrap Linear
                           Preferred_State No_Null_Position Non_Volatile Bitfield
           Item(Main  ): End Collection, data=none
           Item(Global): Usage Page, data= [ 0x89 0xff ] 65417
                           (null)
           Item(Local ): Usage, data= [ 0x0f 0xff ] 65295
                           (null)
           Item(Main  ): Collection, data= [ 0x01 ] 1
                           Application
           Item(Global): Report ID, data= [ 0x05 ] 5
           Item(Local ): Usage Minimum, data= [ 0x00 ] 0
                           (null)
           Item(Local ): Usage Maximum, data= [ 0xff ] 255
                           (null)
           Item(Global): Logical Minimum, data= [ 0x00 ] 0
           Item(Global): Logical Maximum, data= [ 0xff ] 255
           Item(Global): Report Count, data= [ 0x08 ] 8
           Item(Global): Report Size, data= [ 0x01 ] 1
           Item(Main  ): Input, data= [ 0x06 ] 6
                           Data Variable Relative No_Wrap Linear
                           Preferred_State No_Null_Position Non_Volatile Bitfield
           Item(Main  ): End Collection, data=none
           Item(Global): Usage Page, data= [ 0x01 ] 1
                           Generic Desktop Controls
           Item(Local ): Usage, data= [ 0x06 ] 6
                           Keyboard
           Item(Main  ): Collection, data= [ 0x01 ] 1
                           Application
           Item(Global): Report ID, data= [ 0x01 ] 1
           Item(Global): Report Size, data= [ 0x01 ] 1
           Item(Global): Report Count, data= [ 0x08 ] 8
           Item(Global): Usage Page, data= [ 0x07 ] 7
                           Keyboard
           Item(Local ): Usage Minimum, data= [ 0xe0 ] 224
                           Control Left
           Item(Local ): Usage Maximum, data= [ 0xe7 ] 231
                           GUI Right
           Item(Global): Logical Minimum, data= [ 0x00 ] 0
           Item(Global): Logical Maximum, data= [ 0x01 ] 1
           Item(Main  ): Input, data= [ 0x02 ] 2
                           Data Variable Absolute No_Wrap Linear
                           Preferred_State No_Null_Position Non_Volatile Bitfield
           Item(Global): Report Count, data= [ 0x01 ] 1
           Item(Global): Report Size, data= [ 0x08 ] 8
           Item(Main  ): Input, data= [ 0x03 ] 3
                           Constant Variable Absolute No_Wrap Linear
                           Preferred_State No_Null_Position Non_Volatile Bitfield
           Item(Global): Report Count, data= [ 0x05 ] 5
           Item(Global): Report Size, data= [ 0x01 ] 1
           Item(Global): Usage Page, data= [ 0x08 ] 8
                           LEDs
           Item(Local ): Usage Minimum, data= [ 0x01 ] 1
                           NumLock
           Item(Local ): Usage Maximum, data= [ 0x05 ] 5
                           Kana
           Item(Main  ): Output, data= [ 0x02 ] 2
                           Data Variable Absolute No_Wrap Linear
                           Preferred_State No_Null_Position Non_Volatile Bitfield
           Item(Global): Report Count, data= [ 0x01 ] 1
           Item(Global): Report Size, data= [ 0x03 ] 3
           Item(Main  ): Output, data= [ 0x03 ] 3
                           Constant Variable Absolute No_Wrap Linear
                           Preferred_State No_Null_Position Non_Volatile Bitfield
           Item(Global): Usage Page, data= [ 0x07 ] 7
                           Keyboard
           Item(Local ): Usage Minimum, data= [ 0x00 ] 0
                           No Event
           Item(Local ): Usage Maximum, data= [ 0xff 0x00 ] 255
                           (null)
           Item(Global): Logical Minimum, data= [ 0x00 ] 0
           Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
           Item(Global): Report Count, data= [ 0x06 ] 6
           Item(Global): Report Size, data= [ 0x08 ] 8
           Item(Main  ): Input, data= [ 0x00 ] 0
                           Data Array Absolute No_Wrap Linear
                           Preferred_State No_Null_Position Non_Volatile Bitfield
           Item(Global): Usage Page, data= [ 0x07 ] 7
                           Keyboard
           Item(Local ): Usage Minimum, data= [ 0x00 ] 0
                           No Event
           Item(Local ): Usage Maximum, data= [ 0xdf ] 223
                           (null)
           Item(Global): Logical Minimum, data= [ 0x00 ] 0
           Item(Global): Logical Maximum, data= [ 0x01 ] 1
           Item(Global): Report Count, data= [ 0xe0 ] 224
           Item(Global): Report Size, data= [ 0x01 ] 1
           Item(Main  ): Input, data= [ 0x02 ] 2
                           Data Variable Absolute No_Wrap Linear
                           Preferred_State No_Null_Position Non_Volatile Bitfield
           Item(Main  ): End Collection, data=none
           Item(Global): Usage Page, data= [ 0x31 0xff ] 65329
                           (null)
           Item(Local ): Usage, data= [ 0x76 ] 118
                           (null)
           Item(Main  ): Collection, data= [ 0x01 ] 1
                           Application
           Item(Global): Report ID, data= [ 0x5a ] 90
           Item(Local ): Usage Minimum, data= [ 0x00 ] 0
                           (null)
           Item(Local ): Usage Maximum, data= [ 0xff 0x00 ] 255
                           (null)
           Item(Global): Logical Minimum, data= [ 0x00 ] 0
           Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
           Item(Global): Report Size, data= [ 0x08 ] 8
           Item(Global): Report Count, data= [ 0x01 ] 1
           Item(Main  ): Input, data= [ 0x00 ] 0
                           Data Array Absolute No_Wrap Linear
                           Preferred_State No_Null_Position Non_Volatile Bitfield
           Item(Local ): Usage Minimum, data= [ 0x00 ] 0
                           (null)
           Item(Local ): Usage Maximum, data= [ 0xff 0x00 ] 255
                           (null)
           Item(Global): Logical Minimum, data= [ 0x00 ] 0
           Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
           Item(Global): Report Size, data= [ 0x08 ] 8
           Item(Global): Report Count, data= [ 0x10 ] 16
           Item(Main  ): Feature, data= [ 0x00 ] 0
                           Data Array Absolute No_Wrap Linear
                           Preferred_State No_Null_Position Non_Volatile Bitfield
           Item(Main  ): End Collection, data=none
           Item(Global): Usage Page, data= [ 0x31 0xff ] 65329
                           (null)
           Item(Local ): Usage, data= [ 0x79 ] 121
                           (null)
           Item(Main  ): Collection, data= [ 0x01 ] 1
                           Application
           Item(Global): Report ID, data= [ 0x5d ] 93
           Item(Local ): Usage Minimum, data= [ 0x00 ] 0
                           (null)
           Item(Local ): Usage Maximum, data= [ 0xff 0x00 ] 255
                           (null)
           Item(Global): Logical Minimum, data= [ 0x00 ] 0
           Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
           Item(Global): Report Size, data= [ 0x08 ] 8
           Item(Global): Report Count, data= [ 0x05 ] 5
           Item(Main  ): Input, data= [ 0x00 ] 0
                           Data Array Absolute No_Wrap Linear
                           Preferred_State No_Null_Position Non_Volatile Bitfield
           Item(Local ): Usage Minimum, data= [ 0x00 ] 0
                           (null)
           Item(Local ): Usage Maximum, data= [ 0xff 0x00 ] 255
                           (null)
           Item(Global): Logical Minimum, data= [ 0x00 ] 0
           Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
           Item(Global): Report Size, data= [ 0x08 ] 8
           Item(Global): Report Count, data= [ 0x10 ] 16
           Item(Main  ): Feature, data= [ 0x00 ] 0
                           Data Array Absolute No_Wrap Linear
                           Preferred_State No_Null_Position Non_Volatile Bitfield
           Item(Main  ): End Collection, data=none
           Item(Global): Usage Page, data= [ 0x0c ] 12
                           Consumer
           Item(Local ): Usage, data= [ 0x01 ] 1
                           Consumer Control
           Item(Main  ): Collection, data= [ 0x01 ] 1
                           Application
           Item(Global): Report ID, data= [ 0x02 ] 2
           Item(Local ): Usage Minimum, data= [ 0x00 ] 0
                           Unassigned
           Item(Local ): Usage Maximum, data= [ 0x3c 0x02 ] 572
                           AC Format
           Item(Global): Logical Minimum, data= [ 0x00 ] 0
           Item(Global): Logical Maximum, data= [ 0x3c 0x02 ] 572
           Item(Global): Report Size, data= [ 0x10 ] 16
           Item(Global): Report Count, data= [ 0x01 ] 1
           Item(Main  ): Input, data= [ 0x00 ] 0
                           Data Array Absolute No_Wrap Linear
                           Preferred_State No_Null_Position Non_Volatile Bitfield
           Item(Main  ): End Collection, data=none
           Item(Global): Usage Page, data= [ 0x01 ] 1
                           Generic Desktop Controls
           Item(Local ): Usage, data= [ 0x80 ] 128
                           System Control
           Item(Main  ): Collection, data= [ 0x01 ] 1
                           Application
           Item(Global): Report ID, data= [ 0x04 ] 4
           Item(Local ): Usage Minimum, data= [ 0x81 ] 129
                           System Power Down
           Item(Local ): Usage Maximum, data= [ 0x83 ] 131
                           System Wake Up
           Item(Global): Logical Minimum, data= [ 0x00 ] 0
           Item(Global): Logical Maximum, data= [ 0x01 ] 1
           Item(Global): Report Count, data= [ 0x08 ] 8
           Item(Global): Report Size, data= [ 0x01 ] 1
           Item(Main  ): Input, data= [ 0x02 ] 2
                           Data Variable Absolute No_Wrap Linear
                           Preferred_State No_Null_Position Non_Volatile Bitfield
           Item(Main  ): End Collection, data=none
     Endpoint Descriptor:
       bLength                 7
       bDescriptorType         5
       bEndpointAddress     0x81  EP 1 IN
       bmAttributes            3
         Transfer Type            Interrupt
         Synch Type               None
         Usage Type               Data
       wMaxPacketSize     0x0040  1x 64 bytes
       bInterval               4
Device Status:     0x0001
 Self Powered

這告訴我現在無法使用觸摸板方面的東西。我什至看不到它。

所以這是我的問題:為什麼我看不到觸摸板?我該怎麼做才能找到它並開始對其驅動程序進行逆向工程?

連結到啟動板錯誤報告(包含更多日誌文件)

部分答案,主要基於您的觸摸板通過 I2C 連接的資訊:

即使沒有,i2c_hid您也應該能夠看到 I2C 匯流排,並與它們上的設備進行通信。該軟體包lm-sensors具有 I2C 相關程序,如i2c-tools. 安裝,閱讀i2cdetect, i2cdump, i2cget,的手冊頁i2cset

您可能必須修改 I2C 模組,例如i2c-dev,如果它們沒有內置在您的核心中。之後,您應該會在 中看到一些內容/sys/bus/i2c/devices/,並在 下有相應的設備節點/dev/i2c*。現在您必須弄清楚您擁有哪些 I2C 設備(可能有很多:風扇控制、溫度感測器、BIOS EEPROM 等),以及觸摸板是什麼。來自 Windows 驅動程序的資訊可能會有​​所幫助。

下一步是閱讀i2c_hid原始碼,找出是否有任何標準化協議,Google搜尋文件,並嘗試發送和接收字節。在此期間,還要找出為什麼i2c_hid讓您的電腦無法啟動。您需要能夠讀寫 C 程式碼才能做到這一點。

i8042 是傳統的 PS/2 控制器,它與 I2C 完全無關。除非觸摸板是通過 I2C這個控制器連接的,否則弄亂 i8042 核心的東西根本無濟於事。

編輯

我google了一下。I2C 上的 HID 在這裡(顯然是微軟的東西)。一旦您通過 I2C 獲得 HID 工作,您還應該閱讀HID 規範。特別是,查看 HID 描述符。當報告(觸摸板數據)不是很標準時,HID 設備通常會出現問題。

引用自:https://unix.stackexchange.com/questions/450909