changed to use ioctl calls instead of asDevice