fixing #1: maintaining a local attachedDevicesMap