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

Does the gauge share the same bus address as the hid device?

d

Bent from my phone


From: Falong Limailto:xxxxx
Sent: ?6/?24/?2014 12:53 AM
To: Windows System Software Devs Interest Listmailto:xxxxx
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</mailto:xxxxx></mailto:xxxxx>

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.com [mailto:xxxxx@lists.osr.com] 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

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.com [mailto:
> xxxxx@lists.osr.com] *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
>

I can see 7 Intel(R) Atom™ Processor I2C Controller device under System
Device tree. One of hardware ID is like this:
ACPI\VEN_8086&DEV_0F41&REV_0006
ACPI\VEN_8086&DEV_0F41
ACPI\80860F41
*80860F41

can I use the driver to talk to gauge device?

Thanks!

On Wed, Jun 25, 2014 at 5:32 PM, Falong Li wrote:

> 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.com [mailto:
>> xxxxx@lists.osr.com] *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
>>
>
>

Falong Li 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?

*/>> 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?*/

It doesn’t have to implement HID, but look at the subject line of your
message. From the very beginning, you were asking about the HIDI2C
driver. If your device doesn’t do HID, then why would that driver be
relevant?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Falong Li wrote:

I can see 7 Intel(R) Atom™ Processor I2C Controller device under
System Device tree. One of hardware ID is like this:
ACPI\VEN_8086&DEV_0F41&REV_0006
ACPI\VEN_8086&DEV_0F41
ACPI\80860F41
*80860F41

can I use the driver to talk to gauge device?

That’s part of Intel’s “Low Power SubSystem” (lpss). Is there actually
a driver for that device? You might be able to get that to work, but
you would have to figure out how to call that driver. I don’t know
where you would get documentation.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

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>

yes, there is actually driver for the device, but as you said, it is hard
to find the documentation.
Thanks!

On Thu, Jun 26, 2014 at 1:06 AM, Tim Roberts wrote:

> Falong Li wrote:
> > I can see 7 Intel(R) Atom™ Processor I2C Controller device under
> > System Device tree. One of hardware ID is like this:
> > ACPI\VEN_8086&DEV_0F41&REV_0006
> > ACPI\VEN_8086&DEV_0F41
> > ACPI\80860F41
> > *80860F41
> >
> > can I use the driver to talk to gauge device?
>
> That’s part of Intel’s “Low Power SubSystem” (lpss). Is there actually
> a driver for that device? You might be able to get that to work, but
> you would have to figure out how to call that driver. I don’t know
> where you would get documentation.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>
> —
> 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
>

Thank you so much, Peter, I think I know what I need to do!

On Thu, Jun 26, 2014 at 1:22 AM, Peter Wieland
wrote:

> 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.com [mailto:
> xxxxx@lists.osr.com] *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
>
> —
> 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
>

additional question regarding this is how win8 OS get gauge information?
does it also get the information through spbcx? I know that in legacy
platform there is EC which talks to gauge and feed back information to
system via 62/66 port, but now tablet system has no EC. I noted that there
is also a Microsoft ACPI-compliant control method battery device in the
system, is it the one to collect battery information? how does OS serialize
the access from this CM battery and the SPB device driver?

Thanks,

On Thu, Jun 26, 2014 at 10:58 AM, Falong Li wrote:

> Thank you so much, Peter, I think I know what I need to do!
>
>
> On Thu, Jun 26, 2014 at 1:22 AM, Peter Wieland
> wrote:
>
>> 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.com [mailto:
>> xxxxx@lists.osr.com] *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
>>
>> —
>> 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
>>
>
>

I’m not sure, but I suspect that the OS gets its information from the ACPI battery control method, and the control method takes care of reading the information from the gauge. You could always use asl.exe to dump the ACPI tables and see if you can figure out which methods are talking to your gauge – that’s assuming the code to access the gauge is in the ASL and not embedded in some other platform firmware.

Windows doesn’t do anything to serialize access between the CM battery and the SPB device driver. It would be up to the BIOS designer to either put in control methods to access the gauge directly (and then a driver would use those control methods rather than talking to the gauge directly) or to provide some sort of access to the underlying ACPI locks.

If you can get some support from the OEM who is using your gauge for this project, you should discuss that with the (and their BIOS vendor)

-p

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Falong Li
Sent: Thursday, June 26, 2014 12:38 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] access i2c device through hidi2c driver

additional question regarding this is how win8 OS get gauge information? does it also get the information through spbcx? I know that in legacy platform there is EC which talks to gauge and feed back information to system via 62/66 port, but now tablet system has no EC. I noted that there is also a Microsoft ACPI-compliant control method battery device in the system, is it the one to collect battery information? how does OS serialize the access from this CM battery and the SPB device driver?

Thanks,

On Thu, Jun 26, 2014 at 10:58 AM, Falong Li > wrote:
Thank you so much, Peter, I think I know what I need to do!

On Thu, Jun 26, 2014 at 1:22 AM, Peter Wieland > wrote:
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.commailto:xxxxx [mailto:xxxxx@lists.osr.commailto:xxxxx] 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


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></mailto:xxxxx></mailto:xxxxx>