Hi Peter, On Sun, Sep 9, 2012 at 3:08 AM, Peter Hüwe <peterhu...@gmx.de> wrote: >> > I'm curious if there have ever been any attempts to emulate i2c devices >> > under uml in order to facilitate driver development by using stub >> > drivers. >> I know none. > >> If there is a use case, why not. :-) > Thanks for your encouraging words ;) > > I had a look around and found the nice CONFIG_I2C_STUB driver, > which is described in detail at > http://www.kernel.org/doc/Documentation/i2c/i2c-stub > > """This module is a very simple fake I2C/SMBus driver. It implements five > types of SMBus commands: write quick, (r/w) byte, (r/w) byte data, (r/w) > word data, and (r/w) I2C block data.""" > which more or less exactly fits my need. > > The only thing that was missing was general support for I2C which is dependent > on CONFIG_HAS_IOMEM which unfortunately isn't available on UML, > but I simply added a || UML to the Kconfig and was now able to build the I2C > Support, the i2c-dev module (for userspace access) and the i2c-stub driver.
Yes, that's what you typically have to do to get such a thing working. JFYI, on several occasions, I worked on Amiga Zorro bus probing under UML, using fake Zorro devices and real but stubbed network and frame buffer drivers. > If I know load the i2c_stub module I have a emulated i2c device ;) > > I adapted the stub driver to my needs and was now able to create my own > emulated i2c device and start with driver and tools development for it ;) > > > I added the patch, in case you're interested. > > Unfortunately some I2C drivers fail to build if CONFIG_HAS_IOMEM = n, but > don't have that dependency in Kconfig - I simply added it to prevent them from > inclusion. That's because they rely on the HAS_IOMEM dependency for the whole subsystem. In fact, I'm surprised you didn't have to add HAS_IOMEM dependencies to more drivers. > Do you think I should try to push this mainline via the i2c subsystem? As long as there are no "real" i2c drivers for UML, but only dummy/development ones, that is up to the i2c maintainer (in CC). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel