Mostly sensor fixes

This contains a bunch of little patches, mostly fixing issues with sensors.

Also contains a upstream patch to fix a bluetooth crash.