Skip to content

Commit

Permalink
Add Experimental SMBus I2C for decode-dimms
Browse files Browse the repository at this point in the history
  • Loading branch information
eloaders committed Aug 21, 2014
1 parent 99e382e commit 9226731
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
4 changes: 4 additions & 0 deletions I-Nex/i-nex/.src/MStart.module
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Public Sub Main()
"\n --help (Chow Help)"
"\n --library (Chow library)"
"\n --cpuinfo (Use cpuinfo instead of /proc)"
"\n --smbus (smbus)"
"\n"
"\n Env Variables:"
"\n"
Expand All @@ -53,6 +54,9 @@ Public Sub Main()
Case "--conv"
MConvert.Convert(Application.Args[2], Application.Args[3], Application.Args[4])
PrintErr = False
Case "--smbus"
i2c._inits
PrintErr = False
Case ""
Finfosys.Show
PrintErr = False
Expand Down
20 changes: 20 additions & 0 deletions I-Nex/i-nex/.src/i2c.module
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
' Gambas module file

Public Sub _inits()
Dim element As String
Dim vendor, device As String
Dim I2C_BUSES As Collection
Dim i As Integer
I2C_BUSES = JSON.Decode(File.Load("Database/i2c/devices.json"))
For Each element In RDir("/sys/bus/pci/devices/", "*:*")
vendor = Replace(File.Load("/sys/bus/pci/devices/" & element & "/vendor"), "\n", "")
device = Replace(File.Load("/sys/bus/pci/devices/" & element & "/device"), "\n", "")
For i = 0 To I2C_BUSES["I2C"].Count - 1
If I2C_BUSES["I2C"][i]["vendid"] = vendor And I2C_BUSES["I2C"][i]["devid"] = device Then
Print "Found: " & I2C_BUSES["I2C"][i]["procid"]
Print "Need modprobe: eeprom " & I2C_BUSES["I2C"][i]["driver"]
Endif
Next
Next

End
40 changes: 40 additions & 0 deletions I-Nex/i-nex/Database/i2c/devices.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"I2C": {
"0": {
"vendid": "0x8086",
"devid": "0x7113",
"procid": "Intel 82371AB PIIX4 ACPI",
"driver": "i2c-piix4"
},
"1": {
"vendid": "0x8086",
"devid": "0x7603",
"procid": "Intel 82372FB PIIX5 ACPI",
"driver": "to-be-written"
},
"2": {
"vendid": "0x8086",
"devid": "0x719b",
"procid": "Intel 82443MX Mobile",
"driver": "i2c-piix4"
},
"3": {
"vendid": "0x8086",
"devid": "0x2413",
"procid": "Intel 82801AA ICH",
"driver": "i2c-i801"
},
"4": {
"vendid": "0x8086",
"devid": "0x2423",
"procid": "Intel 82801AB ICH0",
"driver": "i2c-i801"
},
"5": {
"vendid": "0x8086",
"devid": "0x27da",
"procid": "Intel 82801G ICH7",
"driver": "i2c-i801"
}
}
}

0 comments on commit 9226731

Please sign in to comment.