From: Denis Bodor Subject: Re: add iic_detach() to iic driver, for USB/IIC adapters To: Janne Johansson Cc: Mark Kettenis , tech@openbsd.org Date: Thu, 12 Sep 2024 09:20:20 +0200 On Thu, Sep 12, 2024 at 08:26:58AM GMT, Janne Johansson wrote: > > There is the beginnings of such an implementation in i2c_io.h > > (JI2C_IOCTL_EXEC behind a ‘#ifdef notyet’ ) but this code has been around > > since 2004. Is this something desirable (notyet == tobedone) or is > > the OpenBSD philosophy to keep access to i2c devices strictly in kernel > > space? > There is some information in this thread > https://marc.info/?l=openbsd-tech&m=164510604215263&w=2 > about the feelings from the project to just randomly allow access to > all kinds of gpio pins a board can expose. I don't know if i2c devices > generally control equally "dangerous" parts on motherboards and sbcs, > but if they do, then some restraint might be in order. Some i2c devices are Hardware Security Modules (like the ATECC608A) and I think it's also possible to do bad things by changing the behaviour or measurements made by a temperature sensor for example. > Now, this i2c behind usb would presumably not be connected to > something the computer owner would not want to allow programmatic > access to, but the previous non-detachable i2c buses might have been. This means making the difference between an internal i2c bus (pci or fdt) and a detachable bus. In this case, what FreeBSD (and NetBSD I think) does for this I2C-Tiny-USB (and CP2112) driver by exposing /dev/iic* can also be done in the form of a library using LibUSB and /dev/ugenx.yy (and therefore 100% user space). Either way is fine, I can finish my driver or rather make a lib and create a port for it. -- Denis