Page 1 of 1

WebUSB & Sex Toys

Posted: 14 Nov 2021, 04:59
by zappy1
WebUSB makes connecting to UBS devices easy. Connecting to the USB port with WebUSB from Javascript can be done with about 15 lines of code. However, how can Javascript put a USB port to sleep? Supposedly there is no way to actually turn a USB port off, so putting it to sleep is supposedly the way to cut power to the USB port. The reason this is relevant is because it would make turning sex toys on and off from Javascript very easy. The goal is to make sex games easy to access and modify by anybody by keeping things simple. Turn sex toy on and off by cutting the power. Then any USB powered sex toy can be used, nothing special to buy,

The usb sleep is part of the power saving in Windows.

Here is someone that used JavaScript to control sex toys at https://github.com/buttplugio/buttplug- ... /master/js. The problem is it requires node.js with lots of code, thus being too complex.

Anyone here knows how to put a USB port to sleep with Javascript with or without WebUSB?

Re: WebUSB & Sex Toys

Posted: 14 Nov 2021, 14:07
by Riddle
I am not familiar with turning USB ports on and off.

Have you considered using some sort of translation device between the computer and the sex toy? USB relay module? Arduino programmed to receive commands from the computer? If you can open a com port and send data to it, you can control a USB relay module or Arduino.

Re: WebUSB & Sex Toys

Posted: 14 Nov 2021, 19:32
by gofc
I tried finding out how to turn ports on / off to control an USB powered vibrator, but I couldn't find an easy way to do this. In the end what worked best for me was using a wifi smart plug and a standard mobile charger: connect the vibrator to the charger, the charger to the smart plug, and then you can turn the plug on or off remotely.

The smart plug I have can be used with the "If This Then That" app, and that allows for different ways to trigger it on and off. One of them is using a webhook (essentially: an url that you can invoke from a browser, or anywhere, to turn it on and off). It's a bit of a roundabout way, but with that and a little coding you can control the vibrator from Javascript if you wish to. Just have your script do a web request for that url. You can even give the link to someone else and have them control it :D Only issue I found was a little lag from url request to actual activation (ranging from 1 to 5-10 seconds).

Depending on the smart plug, you might be able to interface with it more directly and not need the app. I eventually discovered a Python library for mine that could control it from a simple Python script, with no lag at all, so that's what I replaced the ITTT app with.

Re: WebUSB & Sex Toys

Posted: 14 Nov 2021, 21:25
by Riddle
I am having trouble finding a USB powered massager. Any suggestions?

Re: WebUSB & Sex Toys

Posted: 14 Nov 2021, 21:47
by Shannon SteelSlave
Riddle wrote:I am having trouble finding a USB powered massager. Any suggestions?
Is there any way to remove the batteries from a USB charged version, hard wire the circuit, thus making it entirely reliant on a USB power feed, no battery to route to as secondary source?

Re: WebUSB & Sex Toys

Posted: 14 Nov 2021, 22:03
by Riddle
Shannon SteelSlave wrote:
Riddle wrote:I am having trouble finding a USB powered massager. Any suggestions?
Is there any way to remove the batteries from a USB charged version, hard wire the circuit, thus making it entirely reliant on a USB power feed, no battery to route to as secondary source?
Yes and no. It is easy to cut one open and remove the battery. Doing so without ruining the waterproofing is impossible.

Re: WebUSB & Sex Toys

Posted: 14 Nov 2021, 22:51
by Kinbaku
Riddle wrote:I am having trouble finding a USB powered massager. Any suggestions?
The Lovense Domi-2 is a good vibrator with a usb adapter, but I think it is only for loading the battery, not for the power.

This one is USB powered, because I read in the comments that it doesn't work when not put in an USB-port.

Re: WebUSB & Sex Toys

Posted: 13 Dec 2021, 04:01
by rezreal
> Anyone here knows how to put a USB port to sleep with Javascript with or without WebUSB?
You simply can not (at least on the browser from a web page). You can iterate connected devices and use their interfaces, but you can not control such low level usb host features.