Optical detection of surface states in semiconductors