Reset USB port on Mac - macos

I occasionally need to unplug and then re-plugin my usb TV tuner, or I could restart the entire computer... seems to be the only way to get it working again. I'm thinking that a power reset would suffice. So my question is:
Is there any way to reset the USB port on a Mac or reset the power to the USB port through Terminal or another programatic means?

Related

How to capture USB traffic with Wireshark in OSX Catalina (10.15)

I am trying to get Wireshark USB captures working. Apparently the trick prior to Catalina was to just bring the interface up so that Wireshark could see it.
https://forums.developer.apple.com/thread/95380
However, this does not work in Catalina because the USB hubs are not shown as interfaces any longer. Is there another known way to "bring up" these interfaces in OSX? Perhaps a new system policy setting? How would one go about finding such a thing?
It might just be broken now. I imagine Wireshark and ifconfig use the same API to gather info about the interfaces.
You need to disable SIP first
Restart your Mac
Hold down Command-R to reboot into Recovery Mode
Click Utility->Terminal, type "csrutil disable", click Enter.
Restart your Mac
then you can use "sudo ifconfig XHC20 up" command

Trouble connecting phone to arduino using droidScript

I am trying to connect my sony xperia sp running on android 7.1 ( Lineage OS ) to my arduino uno using an OTG cable and the droidScript app. It worked perfectly the first time, it asked permission to open droidScript : I clicked on "OK" and checked "Use by default for this USB device".
But now I can't get it to work. When I reconnect my phone to the Uno nothing happen on my phone, droidScrip does not seem to recognize the device either and now when I try to connect my phone to my computer it does not work either ( but it's charging ).
I have tested all my cables and connected the arduino the same way using a different phone several times and it worked ( but didn't allow "Use by default for this USB device" as I suspect it comes from here ). Manually enable MTP through dev options does not work.
How can I remove that "Use by default for this USB device" option, and get the asking permission box back when I connect to my Uno ?
Try unistalling DroidScript and any other apps that might have talked to that USB device and then re-install DroidScript but don't start it up.
Plugin the OTG cable to the device (make sure you get it the right way round so that the OTG cable goes into the phone end) and then you should see the popup box for permissions.

Is it possible to stop windows from sending SOF packet to my USB device?

I want to test if my USB device will enter suspend after 3ms of IDLE state, but my PC host keeps send SOF packet every 1ms so I want to stop it for ~3ms. Is it possible?
The simplest way is to just tell your computer to go to sleep.
Another way that I think would work would be to connect your device to a USB hub (possibly a root hub inside your computer) that is not being used for any other devices, and then use the Device Manager to disable that hub. Just right-click on the hub and select "Disable".

Mount ejected usb device on Mac

I wanted to know if is possible to mount a USB after it has been removed from the finder, without having to re-enter into the USB port.
On my Mac I connected a USB device, but sometimes after putting the mac suspended, the USB is no longer detected, and then I take it out and insert it again.
Is there any command line to reactivate? I tried with diskutil mount but it does not work, as if the key is removed physically from mac.
Thanks
I do not know if there is a command line tool to do this, but you want to send the opposite of eject to the device, which is "inject". This is a SCSI RBC command that can be sent over USB. After inject, the operating system will attempt to mount it.

iMac developing Bluetooth 4.0 application with external dongle

I have a Late 2009 iMac which doesn't support Bluetooth 4.0 and an USB Bluetooth 4.0 dongle (CSR).
I need to write an OSX application which transfers data with a Bluetooth 4.0 device.
If I plug the dongle, the CBCentralManager returns the state CBCentralManagerStateUnsupported since OSX has loaded the driver for the internal Bluetooth device.
If I issue the following command:
sudo nvram bluetoothHostControllerSwitchBehavior="always"
the OSX loads the driver for the dongle, the CBCentralManager recognize the device but unfortunately both wireless keyboard and magic mouse stop working. Presumably because they use a previous version of Bluetooth.
Is there any way to have both internal Bluetooth and external dongle working together ?
Aside from the development, which I can manage with USB keyboard and mouse, this issue prevents older iMacs to use my app.
Thank you in advance.
...unfortunately both wireless keyboard and magic mouse stop working. Presumably because they use a previous version of Bluetooth.
This is not true. The iMac takes some time to recognize that it has not keyboard and mouse configured. After waiting some time, the iMac asks for pairing keyboard and everything work correctly with the external dongle.

Resources