Ported from OmniRom