Add SMBus/I2C dumping tool to System Information page
This commit is contained in:
parent
89b4716012
commit
441c462e59
5 changed files with 120 additions and 5 deletions
|
|
@ -79,3 +79,45 @@ std::string i2c_detect(i2c_smbus_interface * bus, int mode)
|
|||
return text;
|
||||
|
||||
} /* i2c_detect() */
|
||||
|
||||
/******************************************************************************************\
|
||||
* *
|
||||
* i2c_dump *
|
||||
* *
|
||||
* Prints the values at each address of a given SMBus device *
|
||||
* *
|
||||
* bus - pointer to i2c_smbus_interface to scan *
|
||||
* address - SMBus device address to scan *
|
||||
* *
|
||||
\******************************************************************************************/
|
||||
|
||||
std::string i2c_dump(i2c_smbus_interface * bus, unsigned char address)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
int start = 0x0000;
|
||||
|
||||
char line[128];
|
||||
std::string text;
|
||||
|
||||
sprintf(line, " 0 1 2 3 4 5 6 7 8 9 a b c d e f\r\n");
|
||||
text.append(line);
|
||||
|
||||
for (i = 0; i < 0xFF; i += 16)
|
||||
{
|
||||
sprintf(line, "%04x: ", i + start);
|
||||
text.append(line);
|
||||
|
||||
for (j = 0; j < 16; j++)
|
||||
{
|
||||
sprintf(line, "%02x ", (unsigned char )bus->i2c_smbus_read_byte_data(address, start + i + j));
|
||||
text.append(line);
|
||||
}
|
||||
|
||||
sprintf(line, "\r\n");
|
||||
text.append(line);
|
||||
}
|
||||
|
||||
return text;
|
||||
|
||||
} /* i2c_dump() */
|
||||
|
|
|
|||
|
|
@ -7,3 +7,5 @@
|
|||
#define MODE_FUNC 3
|
||||
|
||||
std::string i2c_detect(i2c_smbus_interface * bus, int mode);
|
||||
|
||||
std::string i2c_dump(i2c_smbus_interface * bus, unsigned char address);
|
||||
|
|
|
|||
|
|
@ -41,3 +41,11 @@ void Ui::OpenRGBSystemInfoPage::on_DetectButton_clicked()
|
|||
|
||||
ui->SMBusDataText->setPlainText(i2c_detect(bus, MODE_QUICK).c_str());
|
||||
}
|
||||
|
||||
void Ui::OpenRGBSystemInfoPage::on_DumpButton_clicked()
|
||||
{
|
||||
i2c_smbus_interface* bus = busses[ui->SMBusAdaptersBox->currentIndex()];
|
||||
unsigned char address = ui->DumpAddressBox->value();
|
||||
|
||||
ui->SMBusDataText->setPlainText(i2c_dump(bus, address).c_str());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ public:
|
|||
private slots:
|
||||
void on_DetectButton_clicked();
|
||||
|
||||
void on_DumpButton_clicked();
|
||||
|
||||
private:
|
||||
Ui::OpenRGBSystemInfoPageUi *ui;
|
||||
std::vector<i2c_smbus_interface *>& busses;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>500</width>
|
||||
<height>300</height>
|
||||
<height>320</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
<widget class="QLabel" name="SMBusAdaptersLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<x>50</x>
|
||||
<y>10</y>
|
||||
<width>100</width>
|
||||
<height>22</height>
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
<widget class="QComboBox" name="SMBusAdaptersBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<x>160</x>
|
||||
<y>10</y>
|
||||
<width>200</width>
|
||||
<height>22</height>
|
||||
|
|
@ -40,9 +40,9 @@
|
|||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>60</y>
|
||||
<y>80</y>
|
||||
<width>400</width>
|
||||
<height>200</height>
|
||||
<height>210</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
|
|
@ -59,6 +59,67 @@
|
|||
<string>Detect Devices</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="DumpButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>370</x>
|
||||
<y>40</y>
|
||||
<width>80</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dump Device</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="SMBusDumpLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>40</y>
|
||||
<width>100</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SMBus Dumper:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="DumpAddressLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>40</y>
|
||||
<width>51</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="DumpAddressBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>280</x>
|
||||
<y>40</y>
|
||||
<width>80</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string>0x</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>255</number>
|
||||
</property>
|
||||
<property name="displayIntegerBase">
|
||||
<number>16</number>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue