![Page 1: USB Card Scanner Driver Patrick Tully Steven Bronson](https://reader036.vdocuments.net/reader036/viewer/2022082816/56649f465503460f94c683b8/html5/thumbnails/1.jpg)
USB Card Scanner Driver
Patrick TullySteven Bronson
![Page 2: USB Card Scanner Driver Patrick Tully Steven Bronson](https://reader036.vdocuments.net/reader036/viewer/2022082816/56649f465503460f94c683b8/html5/thumbnails/2.jpg)
Motivation
Monitors in Majors Lab scan FSU cards using a USB card reader
USB card reader generates keystrokes Program must have focus at all times, in the correct textbox
![Page 3: USB Card Scanner Driver Patrick Tully Steven Bronson](https://reader036.vdocuments.net/reader036/viewer/2022082816/56649f465503460f94c683b8/html5/thumbnails/3.jpg)
Pre-existing Projects
Read from /dev/usb/hiddev Only works for the USB HID card scanner
Write a userspace program using libusb or PyUSB Requires root privileges each time Depends on deprecated (obsolete?) usbfs
![Page 4: USB Card Scanner Driver Patrick Tully Steven Bronson](https://reader036.vdocuments.net/reader036/viewer/2022082816/56649f465503460f94c683b8/html5/thumbnails/4.jpg)
Contribution
Used a small part (boilerplate) of the usbkbd driver as a starting point.
Most of the work went into implementing read, which did not exist in usbkbd.
Create /dev/cardscanner that can be opened and read.
![Page 5: USB Card Scanner Driver Patrick Tully Steven Bronson](https://reader036.vdocuments.net/reader036/viewer/2022082816/56649f465503460f94c683b8/html5/thumbnails/5.jpg)
Challenges
USB probe order Determined by module insertion order Fixed with USB quirks
Kernel circular buffer implementation is not really Record API makes more sense, but Unix loves byte
streams (why pass records when you can design ambiguous grammars?)