Merge "hal: check device type before handling connection/disconnection"