Skip to main content

how to attach a USB device to ubuntu 20 running on WSL

 This article will tackle the steps needed to attach a usb device to ubuntu through WSL on windows 10 

for this tutorial you will nedd 

- Ubuntu 20.xx on wsl2 

- mobixterm 

to start the process you need to run ubuntu 

and type the following on your terminal 


pc:~$ sudo apt install linux-tools-5.4.0-77-generic hwdata
pc:~$ sudo update-alternatives --install /usr/local/bin/usbip usbip /usr/lib/linux-tools/5.4.0-77-generic/usbip 20


Attaching a device

First ensure a WSL command prompt is open. This will keep the WSL 2 lightweight VM active.

From an administrator command prompt on Windows, run this command. It will list all the USB devices connected to Windows.

pc:cmdadmin>  usbipd wsl list


Select the bus ID of the device you’d like to attach to WSL and run this command. You’ll be prompted by WSL for a password to run a sudo command.

pc:cmdadmin> usbipd wsl attach --busid <busid>


From within WSL, run lsusb to list the attached USB devices. You should see the device you just attached and be able to interact with it using normal Linux tools. Note that depending on your application, you may need to configure udev rules to allow non-root users to access the device.

Once you are done using the device in WSL, you can either physically disconnect the device or run this command from an administrator command prompt on Windows.

pc:cmdadmin> usbipd wsl detach --busid <busid>
it is possible for the USB not to work due to rules issue for example if you want to link serial communicaiton with ubuntu 

in this case its posible to use this command 

 

pc:~$ ls /dev/tty* | grep USB
 

pc:~$ sudo chown user: /dev/ttyUSB0

 

Comments

Popular posts from this blog

Heating with Electric Radiators

You want to heat your small garage using a couple of electric radiators. The power and voltage requirements for each radiator are 1200 W, 240 V. But you are not sure how to wire the radiators to the power supplied to the garage. Should you use the wiring diagram on the left or the one on the right? Does it make any difference?

Linear regulator current boost circuits

Voltage Regulator Current Boost Circuits Voltage regulators, such as the LM317, 78xx series, or other linear regulators , are commonly used for providing a stable output voltage. However, these regulators have a maximum current limit , often in the range of 1A to 1.5A for typical ICs. To increase the current handling capability, external pass transistors are added in a current boost configuration. How Current Boost Circuits Work The circuits shown in the image use NPN power transistors ( 2N6133, 2N6124 ) to handle additional current while the regulator maintains voltage regulation. First Circuit (Single NPN Pass Transistor) The voltage regulator drives the base of Q1 (2N6133) . The transistor acts as a current amplifier . R1 limits the base current to Q1, ensuring proper operation. The regulator supplies only a small portion of the total current , while Q1 handles most of the load current . Second Circuit (Darlington Configuration with Current Limit) Uses an additional PN...

Industrial Internet Use-Cases

The potential for the Industrial Internet is vast with opportunities spread over wide areas of productivity, such as logistics, aviation, transportation, healthcare, energy production, oil and gas production, and manufacturing. As a result, many use-cases will make industry executives wake up and consider the possibilities of the IIoT. After all, industry only requires a minimal shift in productivity to deliver huge revenue, an example is that even an increase of 1% of productivity can produce huge revenue benefits such as aviation fuel savings. In order to realize these potential profits, industry has to adopt and adjust to the Industrial Internet of Things. However, spotting, identifying, and then strategically targeting the opportunities of the IIoT is not quite as easy as it might seem. It is important, therefore, to create use-cases that are appropriate to vertical businesses. For instance, the requirements of manufacturing differ from logistics, which also differs to healthcare....