hal: check device type before handling connection/disconnection

Device is assumed to be an output device when handling connection
or disconnection. Besides the BIT_IN, as the input device could
share same bit definition with the output device, thus disconnecting
input device may cause output device disconnected unexpectly.

Check for device type to avoid mishandling.

Change-Id: Iab637220bd43d16bc2cabb53f610ed978e1e5fea
4 files changed