55

I got a scenario, where a software works only when you insert the USB device provided by the software vendor in windows operating system. Im trying to find the content stored in the USB device. In windows operating system, the USB device icon is not shown in My_Computer. I thought, I can see the content or atleast detect the USB device in Ubuntu.

Also in ubuntu, the drive is not detected. I tried "sudo fdisk -l" to know the file system, but its not useful. The drive is not detected at all.

I wanted to know, how the software works only when the USB drive is inserted and it wont when it is not inserted. Do they have any files stored in the USB device? In any case, how can we detect such kind of device in Ubuntu?

Learner
  • 1,171

5 Answers5

62

To detect your USB device, in a terminal, you can try:

  • lsusb , example:

    $ lsusb
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 002: ID 046d:0809 Logitech, Inc. Webcam Pro 9000
    Bus 003 Device 002: ID 046d:c016 Logitech, Inc. Optical Wheel Mouse
    
  • or this powerful tool, lsinput ,
    1st install it, and then try it, it lists all input devices including your USB device :

    sudo apt-get install input-utils
    lsinput
    

    example:

    $ lsinput
    /dev/input/event0
    ...
    
    /dev/input/event1
    ...
    
    /dev/input/event2
    ...
    
    /dev/input/event3
    bustype : BUS_USB
    vendor  : 0x46d
    product : 0xc016
    version : 272
    name    : "Logitech Optical USB Mouse"
    phys    : "usb-0000:00:1d.1-2/input0"
    uniq    : ""
    bits ev : EV_SYN EV_KEY EV_REL EV_MSC
    
  • udevadm , with this command line, you need to unplug the device before using the command and then plug it to see it:

    $ udevadm monitor --udev
    monitor will print the received events for:
    UDEV - the event which udev sends out after rule processing
    UDEV  [1915.787445] add      /devices/pci0000:00/0000:00:1d.3/usb5/5-2 (usb)
    UDEV  [1915.796226] add      /devices/pci0000:00/0000:00:1d.3/usb5/5-2/5-2:1.0 (usb)
    

But it might not work. In my case I m trying to make my Leapfrog Tag run on Ubuntu without success.

Boris
  • 4,932
  • 2
    Thanks for your input. "lsusb" and "udevadm" command list my device though "lsinput" command doesnt provide me any additional information. – Learner Jul 22 '12 at 03:00
5

If the device in question is a software protection dongle, it may not be a mass storage device.

A likely alternate device for it to implement would be an ethernet controller ; the software can communicate with the device via the network adapter, which won't appear as a drive. Or the device could implement a serial port, or another device for which the drivers are included with the operating system.

In any case, this is not an appropriate forum to ask about circumventing the copy protection on Windows software, even if you are trying to do it using Ubuntu.

Adrian
  • 5,216
  • is there any ways to check whether its a software portection dongle or something else? – Learner Jul 21 '12 at 17:53
  • 1
    If it's a device who's sole purpose is to prevent the software running without it being present, it's a software protection dongle. – Adrian Jul 21 '12 at 17:58
  • 1
    Thanks a lot for your comment. It was valuable input for me. I have identified that it is a software protection dongle with your help. I wanted to know much about the technology being used in it and other technical stuff. Do you know any forum like "askubuntu" sort?. I also googled to find about the same. But im not convinced. – Learner Jul 22 '12 at 02:48
3

If you want to detect how a USB device is being loaded- with excellent granularity- here are (2) ways:

udevadm monitor: This will show you the USB device being loaded as the USB Bus sees it.

udevadm is part of the default package udev on 18.04 LTS; no need to install it.

Execute udevadm monitor BEFORE you insert the USB device however.

Specimen output loading a USB flash drive shown below. Skip to the last line and you can even see what device it loaded as (sda1):

udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[969.010067] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1 (usb)
KERNEL[969.010367] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0 (usb)
KERNEL[969.018769] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0 (scsi)
KERNEL[969.018849] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/scsi_host/host0 (scsi_host)
KERNEL[969.018934] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0 (usb)
KERNEL[969.019049] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-1 (usb)
UDEV  [969.024995] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1 (usb)
UDEV  [969.031390] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0 (usb)
UDEV  [969.036362] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0 (scsi)
UDEV  [969.041258] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/scsi_host/host0 (scsi_host)
UDEV  [969.046202] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0 (usb)
UDEV  [969.051734] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-1 (usb)
KERNEL[970.051706] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0 (scsi)
KERNEL[970.052068] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0 (scsi)
KERNEL[970.052215] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0 (scsi_disk)
KERNEL[970.052435] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0 (scsi)
KERNEL[970.052585] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0 (scsi_device)
KERNEL[970.052774] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_generic/sg0 (scsi_generic)
KERNEL[970.052963] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0 (bsg)
UDEV  [970.060833] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0 (scsi)
KERNEL[970.061634] add      /devices/virtual/bdi/8:0 (bdi)
UDEV  [970.069006] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0 (scsi)
UDEV  [970.071467] add      /devices/virtual/bdi/8:0 (bdi)
UDEV  [970.075852] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0 (scsi_disk)
KERNEL[970.079839] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/block/sda (block)
KERNEL[970.079989] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/block/sda/sda1 (block)
UDEV  [970.083556] bind     /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0 (scsi)
UDEV  [970.091288] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0 (scsi_device)
UDEV  [970.091755] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/scsi_generic/sg0 (scsi_generic)
UDEV  [970.106807] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0 (bsg)
UDEV  [970.339976] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/block/sda (block)
UDEV  [970.519549] add      /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/block/sda/sda1 (block)

.

dmesg (which prints the Kernel ring buffer) will also give you granular visibility into the loading of your USB device.

However, dmesg in contrast to udevadm monitor shows you how loading of your external USB device from the Kernel's perspective

Specimen output from dmesg -this time from a USB external CD drive- shown below. The "1-2" refers to its' location on the USB bus: First bus, second port. Had I connected the CD drive to the other port, it would have reported "1-1":

[   55.296482] usb 1-2: new high-speed USB device number 4 using xhci_hcd
[   55.453715] usb 1-2: New USB device found, idVendor=1c6b, idProduct=a222
[   55.453730] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   55.453740] usb 1-2: Product: Mass Storage Device
[   55.453749] usb 1-2: Manufacturer: USB2.0 External
[   55.453758] usb 1-2: SerialNumber: 2010100500000000174
[   55.525860] usb-storage 1-2:1.0: USB Mass Storage device detected
[   55.527273] scsi host0: usb-storage 1-2:1.0
[   55.530031] usbcore: registered new interface driver usb-storage
[   55.545215] usbcore: registered new interface driver uas
[   56.553073] scsi 0:0:0:0: CD-ROM            slimtype  eTDU108   1     SL46 PQ: 0 ANSI: 0
F1Linux
  • 1,066
3

What also works nice when your PC hardware has difficulties with usb events is running a cronjob.

* * * * *    lsusb -v 2>&1 1>/dev/null

This forces a complete scan of the connected USB devices.
Each minute the situation is updated.

Parto
  • 15,325
  • 24
  • 86
  • 117
Kees S.
  • 39
  • Does anyone know if this actually scans the USB ports or does it simply scan the /dev/usb/ directory for already known devices. The way the manpage describes it, appears to only scan the device directory and doesn't refresh the ports. – mchid Jan 26 '22 at 09:08
0

I had a similar issue, sudo fdisk -l didn't show it, gparted didn't show it.

I ran the command dmesg and it showed /dev/sdc1 I then tried mounting it but that gave an error about exFat.

Turned out ubuntu needs special support to read exFat.. I wasn't even aware of exFat, it turns out that USBs are sometimes formatted with exFat, a MS thing. I looked at the USB in windows and even windows showed it was formatted as exFat. This was a USB I got new that came formatted as exFat!

You can install exFat support in ubuntu then reload nautilus(ubuntu's file manager, a search of 'files' or 'nautilus' brings up ubuntu's file manager).

barlop
  • 125
  • 1
  • 9