How often does this actually happen? Never been to the states, keep hearing rumors of illegal device searches like that.
Also I realised that on every visit that I could remember I was getting my baggage searched like some kind of persona non grata, which annoyed me a lot when I thought about it. And this on various flavours of visa/waiver coming from the UK.
So searching laptops etc just for the sake of it, never mind necessity, utility, privacy or courtesy, is a logical (unwelcoming) extension of this.