device: only increase the ref_count when device is truly opened
shell: print the ref count in `list_device`
Merge pull request #287 from grissiom/device-fix

Device fix