How to check if Bluetooth is discoverable?

I know I can make Bluetooth discoverable or undiscoverable with hciconfig hci<X> piscan and hciconfig hci<X> noscan, but how can I check whether it is currently discoverable or not?


Solution 1:

If hciconfig reports UP RUNNING PSCAN ISCAN it is discoverable, if it only reports UP RUNNING it is not.