Re: i2c bus via USB adapter

From: Daniel O'Connor <darius_at_dons.net.au>
Date: Mon, 11 Jul 2022 06:26:34 UTC

> On 11 Jul 2022, at 11:48, John Kennedy <warlock@phouka.net> wrote:
>  Simple recursive grepping didn't get me any hits for MCP2221, and there is
> a TON of hits for Microchip, so currently assuming that FreeBSD doesn't have
> a driver yet.  Total ignorance at this point, but if there was a driver, would
> the expected behavior (assuming right drivers are loaded) would be for the
> system to figure out there was an I2C bus hiding behind it and make another
> /dev/iic# available, devoted to it?

I don't believe there is a FreeBSD driver for it.

>  A ugen driver (generic USB) seems right.  The umodem driver seems
> reasonable (serial device).  The uhid driver seems wrong, at least in
> this case, but of course most of the hits I see on the forums are mice
> and such, so maybe misidentified in this case.

Checking the MCP2221 data sheet shows it does present itself as UART (since it is a UART) and HID (for I2C control)

HID is common because it means you don't need a custom driver (and the associated cost/PITA factor with signing one for Windows & OSX).

Something like this should work on FreeBSD: https://github.com/ZakKemble/libmcp2221
(Might take a bit of porting though)

--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum