Hi, I suggest the following: 1) remove /dev/i2c-0 you created (it is ok, but there should be 4 /dev/i2c-? devices) 2) run modprobe i2c-dev i2c-dev is the device driver for i2c. See: https://www.kernel.org/doc/Documentation/i2c/dev-interface 3) try ls -a /dev/i2c-* you should have 4 device files. 4) try to use i2cset of the i2c-tools project. 5) tell us the results. best regards, Rami Rosen http://ramirose.wix.com/ramirosen On Tue, Apr 23, 2013 at 8:30 AM, Sagar Padhye <sgr.m.pdy@xxxxxxxxx> wrote: > I tried to use 'mknod /dev/i2c-0 c 89 0' and then tried to use the device. > but still when I try to use device it gives IO error (so I concluded, I > created incorrect device) > > > On Mon, Apr 22, 2013 at 7:41 PM, anish singh <anish198519851985@xxxxxxxxx> > wrote: >> >> does I2c-stub create the /dev node?If it is not creating then you >> have to do it yourself. >> >> >> On Mon, Apr 22, 2013 at 5:11 PM, Sagar Padhye <sgr.m.pdy@xxxxxxxxx> wrote: >>> >>> Hi, >>> >>> [USING : Ubuntu 12.04 LTS] >>> >>> 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. >>> >>> 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. >>> >>> The doc also tells about i2c stub. which can be used as follows: >>> 1. load the i2c module >>> 2. use i2cset (from the i2c-tools project) to pre-load some data >>> 3. load the target chip driver module >>> 4. observe its behavior in the kernel log >>> >>> I was able to achieve just the 1st step here. I loaded the module >>> successfully. >>> $ sudo modprobe i2c-stub chip_addr=0x023 >>> >>> I got following Kern msg >>> $dmesg >>> ... >>> [658.071706] i2c-stub: Virtual chip at 0x23 >>> >>> So I believe that step 1 is clear. >>> >>> in second step I have no idea how to provide needed inputs to command >>> -> >>> Usage : i2cset [-f] [-y] [-m mask] I2CBUS CHIP-ADDRESS DATA-ADDRESS >>> [VALUE] [MODE] >>> I tried to give I2CBUS = 0, Chip addr = 0x23 & data addr=0 but it gives >>> error >>> Error : Could not open file '/dev/i2c-0' or '/dev/i2c/0' : No such file >>> or directory >>> >>> There is no file at all created in /dev corrosponding to this device. >>> >>> 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? >>> >>> -- >>> Thanks and Regards, >>> Sagar >>> >>> _______________________________________________ >>> Kernelnewbies mailing list >>> Kernelnewbies@xxxxxxxxxxxxxxxxx >>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies >>> >> >> >> _______________________________________________ >> Kernelnewbies mailing list >> Kernelnewbies@xxxxxxxxxxxxxxxxx >> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies >> > > > > -- > Thanks and Regards, > Sagar > > _______________________________________________ > Kernelnewbies mailing list > Kernelnewbies@xxxxxxxxxxxxxxxxx > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies > _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies