Fix device ID handling on GNU/kFreeBSD.