It is narrated from Sayyiduna Sahl bin Sa'd al-Sa'idi (may Allah be pleased with him) that a man peeped through a hole in the door of the Messenger of Allah (peace and blessings be upon him), while the Messenger of Allah (peace and blessings be upon him) had a comb with which he was combing his hair, or scratching his head (the narrator is unsure). So the Messenger of Allah (peace and blessings be upon him) said: "Had I known that you were waiting for me, I would have thrust this into your eye. The command to seek permission has only been given because of the sight."
Hadith Referenceالمعجم الكبير للطبراني / باب السين / 5645