Added SHM writing.
SHM writing after testing on multiple devices, can handle unplugging and plugging a new device. Ready for CAVE testing.