add debug information to chardev_loop