Home   Evan Doorbell Tapes   Projects   Docs

rhino r1t1/rcbfx/rxt1 dahdi kernel module

Posted May 17th, 2021

TL;DR - Here is a patched Rhino R1T1/RCBFX/RXT1 driver that will work with DAHDI 3.1.0.

Rhino kmod source: https://github.com/t-trmg/rhino-kmod
DAHDI 3.1.0: https://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-3.1.0+3.1.0.tar.gz

This has been tested with a Rhino R1T1 PCI and a Rhino R1T1 PCIe card under Debian 10 using kernel 4.19.0-16-amd64 and Certified Asterisk 16.8-cert8.

A while back I snagged a couple of Rhino R1T1 cards via eBay for dirt cheap. They're both single span T1 cards. One is a PCI card, and the other is a PCIe card with onboard echo cancellation DSP. I was very pleased with the purchases. They have been running happily in my "production" Asterisk box as well as in a "remote" Asterisk box I've built for lugging around to various computery/telephony type events. Both boxes have been running CentOS 7 for a good while. However, given the recent change in the CentOS project structure (thanks, IBM), I have decided that it is time for me to go back to my roots. This means switching back to Debian.

If you are familiar with DAHDI and the kernel evolution, you probably know where this is going. CentOS 7 is based on the 3.10 kernel branch. Debian 10 is based on the 4.19 kernel branch (as of this writing). I am no kernel developer (nor a developer at all by any stretch), but there were some changes between 3.x and 4.x that caused compilation issues with DAHDI. Digium fixed this with the 3.x release of DAHDI. However, in typical Asterisk dev fasion, they had to muck with the API as well. This dominoed into compilation issues with Rhino kernel module. *sigh*

However, with some perseverance and a little help from some friends of mine (thanks, y'all!), I have a mostly working Rhino R1T1 & DAHDI 3.1.0 setup!

It boiled down to two DAHDI API functions the Rhino source was relying on. One function was DAHDI_IRQ_HANDLER, the other was dahdi_pci_module (yes, the former is capitalized, the latter is lowercase). It seems these have been removed from DAHDI. This was pointed out to me via changes made to the te11xp kernel module source (https://github.com/osmocom/dahdi-linux/commit/ca7765aab49d7bc02689a068078e372cda3a7a5f). So, following suit, here are the rather simple modifications that were made:

One change to rhino-linux-0.99.7/drivers/rhino/r1t1/r1t1_base.c:

Line 1036 OLD: DAHDI_IRQ_HANDLER(r1t1_interrupt)
Line 1036 NEW: static irqreturn_t r1t1_interrupt(int irq, void *dev_id)

Two changes to rhino-linux-0.99.7/drivers/rhino/rcbfx/rcbfx_base.c

Line 235 OLD: DAHDI_IRQ_HANDLER(rcb_card_interrupt)
Line 235 NEW: static irqreturn_t rcb_card_interrupt(int irq, void *dev_id)

Line 1919 OLD: res = dahdi_pci_module(&rcb_driver);
Line 1919 NEW: res = pci_register_driver(&rcb_driver);

Two changes to rhino-linux-0.99.7/drivers/rhino/rxt1/rxt1_base.c:

Line 2988 OLD: DAHDI_IRQ_HANDLER(rxt1_card_interrupt_gen2)
Line 2988 NEW: static irqreturn_t rxt1_card_interrupt_gen2(int irq, void *dev_id)

Line 4845 OLD: res = dahdi_pci_module(&rxt1_driver);
Line 4845 NEW: res = pci_register_driver(&rxt1_driver);

Another change that needed to be made was the DAHDI Modules.symvers needed to be brought over. I copied dahdi-linux-complete-3.1.0+3.1.0/linux/drivers/dahdi/Modules.symvers to rhino-linux-0.99.7/drivers/rhino/. If this step is omitted, the kernel module will not load and you'll see complaits via dmesg about DAHDI related symbols that do not exist.

I put the stack through its paces and "wardialed" my test box. I set up a "catch all" dialplan entry in extensions.conf that incorporated Wait(${RAND(0,3)}) before answering, then played back a ~10 second audio file, then released. Hammering it with 23 concurrent calls it didn't completely fall apart! In fact, calling it manually while the wardial campaing was in progress resulted in no audible frame slips. So, I consider it "good enough" for the moment.