/* * A noddy program which tries to reset all AGID's on the DVD-ROM drive. */ #include #include #if defined(__OpenBSD__) # include #elif defined(__linux__) # include #else # error "Need the DVD ioctls" #endif #include #include static int fd; #define DVD "/dev/cdrom" int main(int ac, char **av) { dvd_authinfo ai; char *device = DVD; int i; if (ac > 1) device = av[1]; fd = open(device, O_RDONLY | O_NONBLOCK); if (fd < 0) { printf("unable to open dvd drive (%s).\n", device); return 1; } for (i = 0; i < 4; i++) { memset(&ai, 0, sizeof(ai)); ai.type = DVD_INVALIDATE_AGID; ai.lsa.agid = i; ioctl(fd, DVD_AUTH, &ai); } return 0; }