DONGLE DRM MANAGEMENT RS232 LOOPBACK DONGLE PIN LAYOUT DONGLE CONSTRUCTION DONGLE DETECTION IN SOFTWARE -- Silvio Cesare DONGLE DRM MANAGEMENT --------------------- This is serious [the content is true]. But is rather more humourous than anything :) RS232 LOOPBACK DONGLE --------------------- This dongle is similar to a null modem cable, except that the TD pin is connected back to the RD pin on the same port. The RTS and CTS pins are not connected [in a null modem cable, they are]. This in effect causes the dongle to echo data that is written to the serial line. Dongle detection is therefore performed by verifying that data is being echoed. PIN LAYOUT ---------- PIN/NAME DIRECTION PIN/NAME ---------------------------------------- 2 [TD -> 3 [RD 3 [RD <- 2 [TD 4 [RTS 5 [CTS 6 [DSR <- 20 [DTR 7 [GRND 8 [CD <- 20 [DTR 20 [DTR -> 6 [DSR -> 8 [CD 22 [RI ---------------------------------------- DONGLE CONSTRUCTION ------------------- This dongle started as a breakout box. The breadboard, wires and LED's were from an old electronics kit [funway into electronics]. The rs232 ports were taken from an old NULL modem cable adapter, where the pins were desoldered. New wiring was soldered [for 9 pin], and then attached to do the wire connections between ports, onto the breadboard. The soldering iron was also from the same electronics kit.. It's not as easy as it looks :( v2 of my breakout box used an old connector board I had, which was once part of my old car stero system (the equalizer). It was left over after I replaced the stereo system and removed the equalizer in the process. The breadboard, using tapered screws to hold wires, was sorta shit, compared to the connector board. The connector board makes it easier to build different pin configurations than it was with the breadboard. DONGLE DETECTION IN SOFTWARE ---------------------------- #include #include #include #include #include #include int main(int argc, char *argv[]) { int fd; int ret = -1; fd = open("/dev/ttyS0", O_RDWR); struct timeval tv = { 1, 0 }; if (fd != -1) { #define __DATA "boo\n" #define __DATA_SIZE (sizeof(__DATA) - 1) char b[__DATA_SIZE]; int n; fd_set s; write(fd, __DATA, __DATA_SIZE); FD_ZERO(&s); FD_SET(fd, &s); n = select(fd + 1, &s, NULL, NULL, &tv); if (n == 1 && read(fd, b, __DATA_SIZE) == __DATA_SIZE && memcmp(b, __DATA, __DATA_SIZE) == 0 ) ret = 0; #undef __DATA #undef __DATA_SIZE } if (ret == 0) printf("D0ngle DETECTED\n"); else printf("NO D0ngle\n"); exit(0); }