I wrote this comment up here: https://news.ycombinator.com/item?id=24626193 but thought it was worth a dedicated discussion.
how would you legislate against this?
You don't deal with it by law. You deal with it by refusing to be treated like that - by physically destroying the device, if needed.
A machine is an extension of its owner. Whips, billy clubs, guns, and knives don't get into trouble when they're used to damage or kill people. The people that use them are. The same logic would apply here. Why wouldn't it?
In the end all laws that would apply in this situation (unless OP provides more information) already exist and have existed since the first written laws.
Therefore it will be fine as long as all punishment is self inflicted and you always have the ability to just ignore it or turn it off.