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?
WebUSB & Sex Toys
Moderators: Riddle, Shannon SteelSlave
Re: WebUSB & Sex Toys
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.
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.
Resident timer maker.
Let’s make timers together!
Let’s make timers together!
Re: WebUSB & Sex Toys
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 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.
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 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.
Last edited by gofc on 05 Dec 2021, 22:39, edited 1 time in total.
Re: WebUSB & Sex Toys
I am having trouble finding a USB powered massager. Any suggestions?
Resident timer maker.
Let’s make timers together!
Let’s make timers together!
- Shannon SteelSlave
- Moderator
- Posts: 6614
- Joined: 03 Feb 2019, 19:49
- Location: New England, USA
Re: WebUSB & Sex Toys
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?Riddle wrote:I am having trouble finding a USB powered massager. Any suggestions?
Bondage is like a foreign film without subtitles. Only through sharing and practice can we hope to understand.
A Jedi uses bondage for knowledge and defense, never for attack.
I am so smart! I am so smart! S-M-R-T!....I, I mean S-M-A-R-T!
A Jedi uses bondage for knowledge and defense, never for attack.
I am so smart! I am so smart! S-M-R-T!....I, I mean S-M-A-R-T!
Re: WebUSB & Sex Toys
Yes and no. It is easy to cut one open and remove the battery. Doing so without ruining the waterproofing is impossible.Shannon SteelSlave wrote: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?Riddle wrote:I am having trouble finding a USB powered massager. Any suggestions?
Resident timer maker.
Let’s make timers together!
Let’s make timers together!
Re: WebUSB & Sex Toys
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.Riddle wrote:I am having trouble finding a USB powered massager. Any suggestions?
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
> 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.
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.