I will report on joint work with Dimitri Wyss and Paul Ziegler. We will discuss p-adic integrals of Hasse invariants of canonical gerbes on moduli spaces of Higgs bundles. This can be applied to solve a conjecture by Hausel--Thaddeus and sheds new light on geometric endoscopy.