That's also assuming the device is fully documented and that hardware behaves exactly as documented.

Anyone who has done any work with hardware can confirm that neither of these things is ever true. :(