A slightly more reliable way of extracting the device name. Thanks John.

Signed-off-by: Daan Hoogland <daan@onecht.net>