I asked if you supported HID over I2C because you asked about using HIDI2C. That’s a driver for devices which implement the HID over I2C protocol. If your gauge doesn’t (and there’s no real reason it should) then you cannot use that driver.
Instead you’ll need to write a device driver for your gauge. It could be a KMDF or UMDF driver. It will talk to your gauge through one of the system’s I2C controller drivers. Look for “Simple Peripheral Bus” in the WDK documentation. Note that documentation mixes up concepts for implementing an I2C controller driver and implementing an I2C client driver. You only care about the client driver part.
The driver will bridge between your diagnostic or data-collection app and the hardware, since we don’t presently let apps talk directly to I2C/GPIO devices. So you’ll define some IO controls for your app to send to the driver (DeviceIoControl). The driver will then send gauge specific commands to the device through the I2C driver, and may register for interrupt handling if your gauge has an interrupt line.
I think the biggest challenge will be getting the driver loaded on the system. You’ll need the OEM to create an ACPI table entry for your gas gauge and assign it the correct I2C and GPIO resources. You might be able to do this yourself if you can find out which I2C controllers and GPIO pins the gauge is attached to (do you have a schematic) and then can match those to the ACPI entries.
-p
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Falong Li
Sent: Wednesday, June 25, 2014 2:33 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] access i2c device through hidi2c driver
Peter,
Is this a system that you or your company designed? Do you have the ability to talk to the firmware authors to make sure that your reading from the gas gauge won’t screw up the platform firmware in some way?
>> the system is not designed by us, and we’re gauge vendor for the system.
Do you know the I2C address of the gauge? Do you know the ACPI device tree name for the I2C controller that it’s attached to?
>> sure, I know the i2c address of the gauge. so far I don’t know the ACPI device tree name.
Do you know if the gauge actually implements the HID over I2C protocol? If not you can’t use HIDI2C to communicate with it. You’d have to write your own driver.
> no, gauge does not implement the HID over I2C protocol, but why gauge need this feature? it is just a typical I2C slave. what kind of driver should I write if I have to, I mean what the driver would do?
If you’re trying to get the current battery level periodically, why not try powercfg.exe /batteryreport?
> its not enough for analyse gauge behavior, we need much more information from gauge to dig.
appreciate your great help!
F.L.
On Wed, Jun 25, 2014 at 8:22 AM, Peter Wieland > wrote:
Is this a system that you or your company designed? Do you have the ability to talk to the firmware authors to make sure that your reading from the gas gauge won’t screw up the platform firmware in some way?
Do you know the I2C address of the gauge? Do you know the ACPI device tree name for the I2C controller that it’s attached to?
Do you know if the gauge actually implements the HID over I2C protocol? If not you can’t use HIDI2C to communicate with it. You’d have to write your own driver.
If you’re trying to get the current battery level periodically, why not try powercfg.exe /batteryreport?
-p
From: xxxxx@lists.osr.commailto:xxxxx [mailto:xxxxx@lists.osr.commailto:xxxxx] On Behalf Of Falong Li
Sent: Tuesday, June 24, 2014 12:53 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] access i2c device through hidi2c driver
Hi all,
In a win8 tablet system, gas gauge device is attached to SOC i2c bus, I’d like to write an application to read data from gas gauge device periodically so that data can be logged and analysed later. I know there is a hidi2c.sys driver existing there, but I’m not sure if I can talk to gauge device with this driver? assuming I2C controller driver has been there and ACPI also exposed the gauge device.
If so, how to start with it? can you please advise some steps? I googled for some time but there is no reference for this.
Thanks a lot!
FL
— NTDEV is sponsored by OSR Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See http://www.osr.com/careers For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
—
NTDEV is sponsored by OSR
Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
OSR is HIRING!! See http://www.osr.com/careers
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
— NTDEV is sponsored by OSR Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See http://www.osr.com/careers For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx>