<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPC MicrocontrollersのトピックI2C Over USB Application using LPC1347 and LPCOpen</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Over-USB-Application-using-LPC1347-and-LPCOpen/m-p/1053041#M40779</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/kerryzhou"&gt;kerryzhou&lt;/A&gt;‌&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;LPC1347 LPCOpen usbd_rom_hid_i2c example code&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For my project I am using an LPC1347 development board. I am trying to achieve an I2C communication with a Microchip 256K I2C Serial EEPROM over USB. The functionality is as such : from my host (desktop computer) I can issue a command to write data to any of the address in the EEPROM and read the data back from any of the register. For this I used the already existing example code given in the LPCOpen libraries.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The communication takes place successfully however I am unable to understand a few things. Whenever I send an out report to the device (LPC1347 dev. board) to initialize the I2C, I receive an IN Report with successful initialization and then four other IN reports in which the host requesting resets whereas I immediately send an OUT request to read a register. I do get the read data in the IN report after sending the read request but there are four reset requests in between the two.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, there are four resets after the IN report corresponding to a read operation is received.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to know why the reset operation takes place. I understand that the host repeatedly polls the device.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be really appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Madhukar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Jul 2020 23:36:33 GMT</pubDate>
    <dc:creator>rocketbot27</dc:creator>
    <dc:date>2020-07-01T23:36:33Z</dc:date>
    <item>
      <title>I2C Over USB Application using LPC1347 and LPCOpen</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Over-USB-Application-using-LPC1347-and-LPCOpen/m-p/1053041#M40779</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;&lt;A class="jx-jive-macro-user" href="https://community.nxp.com/people/kerryzhou"&gt;kerryzhou&lt;/A&gt;‌&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;LPC1347 LPCOpen usbd_rom_hid_i2c example code&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For my project I am using an LPC1347 development board. I am trying to achieve an I2C communication with a Microchip 256K I2C Serial EEPROM over USB. The functionality is as such : from my host (desktop computer) I can issue a command to write data to any of the address in the EEPROM and read the data back from any of the register. For this I used the already existing example code given in the LPCOpen libraries.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The communication takes place successfully however I am unable to understand a few things. Whenever I send an out report to the device (LPC1347 dev. board) to initialize the I2C, I receive an IN Report with successful initialization and then four other IN reports in which the host requesting resets whereas I immediately send an OUT request to read a register. I do get the read data in the IN report after sending the read request but there are four reset requests in between the two.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, there are four resets after the IN report corresponding to a read operation is received.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to know why the reset operation takes place. I understand that the host repeatedly polls the device.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be really appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Madhukar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2020 23:36:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Over-USB-Application-using-LPC1347-and-LPCOpen/m-p/1053041#M40779</guid>
      <dc:creator>rocketbot27</dc:creator>
      <dc:date>2020-07-01T23:36:33Z</dc:date>
    </item>
    <item>
      <title>Re: I2C Over USB Application using LPC1347 and LPCOpen</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Over-USB-Application-using-LPC1347-and-LPCOpen/m-p/1053042#M40780</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;&lt;A _jive_internal="true" class="" data-content-finding="Community" data-userid="360186" data-username="madhukar.arora@colorado.edu" href="https://community.nxp.com/people/madhukar.arora@colorado.edu" style="color: #3d9ce7; background-color: #ffffff; border: 0px; font-weight: 600; text-decoration: underline; font-size: 11.9994px;"&gt;Madhukar Arora&lt;/A&gt;&lt;SPAN style="color: #646464; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #646464; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp; Thanks for your trust, I am already not support the LPC product anymore, I mainly support the NXP I.MX RT and the kinetis product now. So, about your new LPC question, our LPC engineer will help you, please keep patient, thanks a lot for your understanding.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #646464; background-color: #ffffff;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #646464; background-color: #ffffff;"&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #646464; background-color: #ffffff;"&gt;&lt;SPAN&gt;Kerry&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 03 Jul 2020 02:54:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Over-USB-Application-using-LPC1347-and-LPCOpen/m-p/1053042#M40780</guid>
      <dc:creator>kerryzhou</dc:creator>
      <dc:date>2020-07-03T02:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: I2C Over USB Application using LPC1347 and LPCOpen</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Over-USB-Application-using-LPC1347-and-LPCOpen/m-p/1053043#M40781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello &lt;A _jive_internal="true" class="" data-content-finding="Community" data-userid="360186" data-username="madhukar.arora@colorado.edu" href="https://community.nxp.com/people/madhukar.arora@colorado.edu"&gt;Madhukar Arora&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reset request in the hid_i2c clears all the control/status flags. This means that the device will abort and flush all the pending requests of the device.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know if this is helpful, if you have more questions do not hesitate to ask me.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Omar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2020 22:33:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Over-USB-Application-using-LPC1347-and-LPCOpen/m-p/1053043#M40781</guid>
      <dc:creator>Omar_Anguiano</dc:creator>
      <dc:date>2020-07-08T22:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: I2C Over USB Application using LPC1347 and LPCOpen</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Over-USB-Application-using-LPC1347-and-LPCOpen/m-p/1053044#M40782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Omar,&lt;BR /&gt;Thank you for your reply. I understand that the reset requests clears all the request and control/status flags.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I don't understand why there is a reset request automatically sent after I send a request to initialize the I2C.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached is a source file I am using to communicate with the EEPROM from the host {LINUX MACHINE} over USB I2C bridge.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="color: #d4d4d4; background-color: #1e1e1e; font-weight: normal; font-size: 14px;"&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;/**&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt; * @ Author : Madhukar Arora&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt; * @ Brief : Testing the LPC1347 as a HID.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt; * &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;*/&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#include&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"host_hid.h"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#include&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"hidraw.h"&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#include&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;&amp;lt;inttypes.h&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #6a9955;"&gt;//request for out_report&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; HOST_REQ_RESET (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;40&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* host requesting reset automatically */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; REQ_HID_I2C_INIT (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* host requesting initialization of I2C */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; REQ_HID_I2C_DEINIT (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* host requesting denitialization of I2C*/&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; REQ_HID_I2C_WRITE (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;3&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* host requesting an I2C Write*/&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; REQ_HID_I2C_READ (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;4&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* host requesting an I2C Read*/&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; REQ_HID_I2C_DEVICE_XFER (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;5&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/*host requesting an I2C Transfer, handles read and write condition*/&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt;const&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;char&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; *device = &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"/dev/hidraw8"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt;const&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;char&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; *&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;bus_str&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;int&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;bus&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #c586c0;"&gt;#define&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt; REPORT_HEAD_SIZE (&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;4&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;//size of out structure without any data&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt;struct&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; out_report&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; length;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; transId;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; sesId;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; req;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;64&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;];&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;};&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt;struct&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; in_report&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; length;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; transId;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; sesId;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;uint8_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; resp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;uint32_t&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;64&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;];&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;};&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt;struct&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; out_report out_rep;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt;int&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;main&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;void&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;int&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; fd = -&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;//file descriptor for hid device&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;int&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; i, err = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;char&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;buff&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;256&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;];&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;struct&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; hidraw_report_descriptor rpt_desc;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;struct&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; hidraw_devinfo info;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; ((fd = &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;open&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(device, O_RDWR)) &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;perror&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Failed to Open the Device"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;exit&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;// Get size of Report Descriptor&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; err = &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;ioctl&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(fd, HIDIOCGRDESCSIZE, &amp;amp;&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;rpt_desc&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;size&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (err &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;perror&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Error getting descriptor size"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;else&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Report Descriptor Size: %d&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;rpt_desc&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;size&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;// Get report descriptor&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; err = &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;ioctl&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(fd, HIDIOCGRDESC, &amp;amp;rpt_desc);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (err &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;perror&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Error getting report descriptor"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;else&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Report Descriptor &lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (i = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; i &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;rpt_desc&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;size&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; i++)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"%hhx "&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;rpt_desc&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;value&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;[i]);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;// Get raw info&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; err = &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;ioctl&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(fd, HIDIOCGRAWINFO, &amp;amp;info);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (err &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;perror&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Error getting raw info"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;else&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;RAW INFO &lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Bus Type : %d %s &lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;info&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;bustype&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;bus_str&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;info&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;bustype&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;));&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Vendor Information: 0x%04hx &lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;info&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;vendor&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Product Information: 0x%04hx &lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;info&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;product&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;// HID get raw name&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; err = &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;ioctl&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(fd, &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HIDIOCGRAWNAME&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;256&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;), buff);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (err &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;perror&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Error getting raw name"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;else&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Raw Name : %s&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, buff);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;// HID get raw physical address&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; err = &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;ioctl&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(fd, &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;HIDIOCGRAWPHYS&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;256&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;), buff);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (err &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;perror&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Error getting raw physical address"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;else&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Physical Address : %s&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, buff);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* write */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; = REPORT_HEAD_SIZE;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;transId&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;sesId&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;req&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; = REQ_HID_I2C_INIT;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;] = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;100000&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; += (&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;sizeof&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) / &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;sizeof&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;]));&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"LENGTH OF OUT REPORT %"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; PRIu8 &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; err = &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;write&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(fd, &amp;amp;out_rep, &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;sizeof&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;struct&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; out_report));&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (err &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Error : %d&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, errno);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;perror&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Error writing data packet"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;else&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"write wrote %d bytes&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, err);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* read */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; err = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;int&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; j = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;while&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; ((err == &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) || (j % &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;4&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; != &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; j++;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; err = &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;read&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(fd, buff, &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;256&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (err &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Error :%d&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, errno);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;perror&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"read failed!"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;else&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;struct&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; in_report *in_rep = (&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;struct&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; in_report *)buff;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;in_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;resp&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; != HOST_REQ_RESET)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"in_report length %"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; PRIu8 &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;in_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"in_report transId %"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; PRIu8 &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;in_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;transId&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"in_report sesId %"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; PRIu8 &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;in_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;sesId&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"in_report resp %"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; PRIu8 &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;in_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;resp&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (i = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;4&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; i &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;in_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; i++)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"%c "&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;buff&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;[i]);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Reading data from a register in the EEPROM&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; = REPORT_HEAD_SIZE;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;transId&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;sesId&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;req&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; = REQ_HID_I2C_DEVICE_XFER;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;] = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;//txlength&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;] = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;1&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;//rxlen&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;2&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;] = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;//no options&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;3&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;] = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0x50&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;//slave addr&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;4&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;] = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0x00&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;5&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;] = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0x02&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; += (&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;sizeof&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) / &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;sizeof&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;out_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;[&lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;]));&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; err = &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;write&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(fd, &amp;amp;out_rep, &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;sizeof&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;struct&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; out_report));&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (err &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Error : %d&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, errno);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;perror&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Error writing data packet"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;else&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"write wrote %d bytes&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, err);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #6a9955;"&gt;/* read */&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; err = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; j = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;while&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; ((err == &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;) || (j % &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;4&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; != &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; j++;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; err = &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;read&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(fd, buff, &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;256&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (err &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;0&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Error :%d&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, errno);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;perror&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"read failed!"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;else&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;struct&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; in_report *in_rep = (&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;struct&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; in_report *)buff;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;in_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;resp&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; != HOST_REQ_RESET)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"in_report length %"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; PRIu8 &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;in_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"in_report transId %"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; PRIu8 &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;in_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;transId&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"in_report sesId %"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; PRIu8 &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;in_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;sesId&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"in_report resp %"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; PRIu8 &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;in_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;resp&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;for&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (i = &lt;/SPAN&gt;&lt;SPAN style="color: #b5cea8;"&gt;4&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; i &amp;lt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;in_rep&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;; i++)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"%c "&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;buff&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;[i]);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;printf&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d7ba7d;"&gt;\n&lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;close&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(fd);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN style="color: #569cd6;"&gt;const&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;char&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; *&lt;/SPAN&gt;&lt;SPAN style="color: #dcdcaa;"&gt;bus_str&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #569cd6;"&gt;int&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #9cdcfe;"&gt;bus&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;{&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;switch&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; (bus)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; {&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;case&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; BUS_USB:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"USB"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;break&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;case&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; BUS_HIL:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"HIL"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;break&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;case&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; BUS_BLUETOOTH:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Bluetooth"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;break&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;case&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; BUS_VIRTUAL:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Virtual"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;break&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;default&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ce9178;"&gt;"Other"&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #c586c0;"&gt;break&lt;/SPAN&gt;&lt;SPAN style="color: #d4d4d4;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt; }&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="color: #d4d4d4;"&gt;}&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 09 Jul 2020 18:28:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2C-Over-USB-Application-using-LPC1347-and-LPCOpen/m-p/1053044#M40782</guid>
      <dc:creator>rocketbot27</dc:creator>
      <dc:date>2020-07-09T18:28:28Z</dc:date>
    </item>
  </channel>
</rss>

