<div dir="ltr">does I2c-stub create the /dev node?If it is not creating then you<div>have to do it yourself.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Apr 22, 2013 at 5:11 PM, Sagar Padhye <span dir="ltr"><<a href="mailto:sgr.m.pdy@gmail.com" target="_blank">sgr.m.pdy@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>[USING : Ubuntu 12.04 LTS]</div><div><br><div>I am trying to learn I2C subsystem. I havent found much of well documented things that can help a newbie on google. I just chose to read the linux kernel documentation txts.<br clear="all">
<div><br></div><div>I read the way kernel can interact with i2c through both SMBus calls & raw file op calls (ioctl, read, write). It looks good till that point.</div><div><br></div><div>The doc also tells about i2c stub. which can be used as follows:</div>
<div><div><span style="white-space:pre-wrap">        </span>1. load the i2c module</div><div><span style="white-space:pre-wrap">        </span>2. use i2cset (from the i2c-tools project) to pre-load some data</div><div><span style="white-space:pre-wrap">        </span>3. load the target chip driver module</div>
<div><span style="white-space:pre-wrap">        </span>4. observe its behavior in the kernel log</div><div><br></div><div>I was able to achieve just the 1st step here. I loaded the module successfully.</div><div>
$ sudo modprobe i2c-stub chip_addr=0x023</div><div><br></div><div>I got following Kern msg</div><div>$dmesg</div><div>...</div><div>[658.071706] i2c-stub: Virtual chip at 0x23</div><div>
<br></div><div>So I believe that step 1 is clear.</div><div><br></div><div>in second step I have no idea how to provide needed inputs to command</div><div>-></div><div>Usage : i2cset [-f] [-y] [-m mask] I2CBUS CHIP-ADDRESS DATA-ADDRESS [VALUE] [MODE]</div>
<div>I tried to give I2CBUS = 0, Chip addr = 0x23 & data addr=0 but it gives error</div><div>Error : Could not open file '/dev/i2c-0' or '/dev/i2c/0' : No such file or directory</div><div>
<br></div><div>There is no file at all created in /dev corrosponding to this device.</div><div><br></div><div>Any idea how to use i2c properly? Is this an ubuntu only problem? Can anybody provide a good tutorial like thing to learn about i2c kernel & userspace driver programming?</div>
<span class="HOEnZb"><font color="#888888">
<div><br></div></font></span></div><span class="HOEnZb"><font color="#888888">-- <br><div dir="ltr">Thanks and Regards,<div>Sagar</div></div>
</font></span></div></div></div>
<br>_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br></blockquote></div><br></div>