No need to check write access if we call open() right after which checks that anyway. Also only get the device name once.