I think your process is difficult because it is backwards. Probably easier to take the closest openbsd driver, start removing wrong-device-specific parts from it and put your own device specific parts into it.
It will difficult to ensure your driver-independent pieces are correct if you are picking them one by one out of other code. jon@elytron.openbsd.amsterdam wrote: > Thanks for your reply. Yes, I'm using ttymalloc but I'm having a > hard time telling where the terminal has attached to. For context, > I'm working on adding support for a certain cardbus 3g modem. For > a while I considered using puc at cardbus but it seems both the > interrupt handling and the non standard terminal sequences warrant > a full separate driver. I wondered if attaching com at this new > device would make sense, but at the moment I'm taking the linux > approach of implementing it's own tty code. > > At the moment I can initialize the card and process interrups, just > need to figure out the tty bits. Here is the freebsd driver I'm > using as reference (was also work in progress) > > http://web.archive.org/web/20080327050955/http://bsd.vwsoft.com/3g/nozomi/nozomi.c > > also, https://marc.info/?l=openbsd-tech&m=166127896828617&w=2 >