USB quirks

https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=245931

1. Finding the VID and PID of your USB SSD
Disconnect the USB SSD. In a terminal window, run the command sudo dmesg -C.
Now, plug in the SSD and run dmesg with no parameters.
You should get output that looks like this:
CODE: SELECT ALL

[ 4096.609817] usb 2-1: new SuperSpeed Gen 1 USB device number 4 using xhci_hcd
[ 4096.646369] usb 2-1: New USB device found, idVendor=2109, idProduct=0715, bcdDevice=a0.00
[ 4096.646385] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 4096.646397] usb 2-1: Product: SABRENT
[ 4096.646409] usb 2-1: Manufacturer: SABRENT
[ 4096.646421] usb 2-1: SerialNumber: 000000123AD2
[ 4096.655154] scsi host0: uas
[ 4096.669178] scsi 0:0:0:0: Direct-Access SABRENT 2210 PQ: 0 ANSI: 6
[ 4096.670993] sd 0:0:0:0: Attached scsi generic sg0 type 0
[ 4096.673710] sd 0:0:0:0: [sda] 234441648 512-byte logical blocks: (120 GB/112 GiB)
The idVendor and idProduct are the two hexadecimal numbers you need to take a note of.

1a. Multiple SSDs
If you have multiple USB SSD devices plugged into a single Pi 4, then for each device experiencing issues repeat Step 1 above and make a note of each idVendor and idProduct pair.

2. Add the quirks to /boot/cmdline.txt
Run a text editor as root – sudo nano /boot/cmdline.txt from the console or sudo leafpad /boot/cmdline.txt from the desktop.
At the start of the line of parameters, add the text usb-storage.quirks=aaaa:bbbb:u where aaaa is the idVendor for your device and bbbb is the idProduct. So, with the device above the string will be usb-storage.quirks=2109:0715:u.
cmdline.png
cmdline.png (21.45 KiB) Viewed 46967 times
For multiple devices with different VID:PID pairs, expand the parameter with a comma between each vid:pid:u triplet like this: usb-storage.quirks=0123:4567:u,2109:0715:u.

Save the file and exit the editor.

3. Reboot.

4. Check that it worked
To check that the quirk has been applied successfully, run dmesg | grep usb-storage and check that the VID and PID is listed as having a quirk applied:
CODE: SELECT ALL

[ 2.495725] usb 2-1: UAS is blacklisted for this device, using usb-storage instead
[ 2.512739] usb 2-1: UAS is blacklisted for this device, using usb-storage instead
[ 2.531823] usb-storage 2-1:1.0: USB Mass Storage device detected
[ 2.549642] usb-storage 2-1:1.0: Quirks match for vid 2109 pid 0715: 800000
[ 2.566177] scsi host0: usb-storage 2-1:1.0

Re: STICKY: If you have a Raspberry Pi 4 and are getting bad speeds transferring data to/from USB3.0 SSDs, read this
Post by harrytv » 25 Jan 2020 13:42

I had a lot of issues with stuttering video playback using Libreelec 9.2.0. Media files (mkv, h264) were located on a very fast 1TB SSD connected via a USB3.0 adapter. I finally hit this post and it helped tremendously. Here is what I did for completeness.

* I logged in as user `root` using Putty SSH from a Windows machine, using default password.
* Disconnected USB drive and ran (since this is libreelec no need for `sudo`)
CODE: SELECT ALL

dmesh -c
* Reconnected the USB drive and ran:
CODE: SELECT ALL

dmesh
[ 342.605668] usb 2-1: new SuperSpeed Gen 1 USB device number 3 using xhci_hcd
[ 342.626900] usb 2-1: New USB device found, idVendor=152d, idProduct=1561, bcd Device= 2.04
[ 342.626921] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 342.626938] usb 2-1: Product: SABRENT
[ 342.626953] usb 2-1: Manufacturer: SABRENT
[ 342.626968] usb 2-1: SerialNumber: DB9876543214E
[ 342.639515] scsi host0: uas
[ 342.640972] scsi 0:0:0:0: Direct-Access SABRENT 0204 PQ : 0 ANSI: 6
[ 345.935277] sd 0:0:0:0: [sda] 1953525168 512-byte logical blocks: (1.00 TB/93 2 GiB)
[ 345.935286] sd 0:0:0:0: [sda] 4096-byte physical blocks
[ 345.935531] sd 0:0:0:0: [sda] Write Protect is off
[ 345.935538] sd 0:0:0:0: [sda] Mode Sense: 53 00 00 08
[ 345.936048] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, does n’t support DPO or FUA
[ 345.936856] sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes not a mult iple of physical block size (4096 bytes)
[ 345.940078] sda: sda1
* As can be seen this is a USB3.0 SATA 3 adapter from Sabrent. Running in `uas` mode.
* To verify how poorly this was running I tested the speed using:
CODE: SELECT ALL

hdparm -t /dev/sda1
/dev/sda1:
Timing buffered disk reads: 516 MB in 33.25 seconds = 15.52 MB/sec
* Which of course is extremely slow. I then checked the log again using `dmesg`:
CODE: SELECT ALL

[ 1247.365069] usb 2-1: reset SuperSpeed Gen 1 USB device number 3 using xhci_hcd
[ 1247.387663] scsi host0: uas_eh_device_reset_handler success
[ 1279.648929] sd 0:0:0:0: [sda] tag#3 uas_eh_abort_handler 0 uas-tag 4 inflight: CMD IN
[ 1279.648937] sd 0:0:0:0: [sda] tag#3 CDB: opcode=0x28 28 00 03 fa 64 50 00 01 00 00
[ 1279.649085] sd 0:0:0:0: [sda] tag#1 uas_eh_abort_handler 0 uas-tag 2 inflight: CMD IN
[ 1279.649091] sd 0:0:0:0: [sda] tag#1 CDB: opcode=0x28 28 00 00 00 10 00 00 04 00 00
[ 1279.649553] sd 0:0:0:0: [sda] tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD IN
[ 1279.649559] sd 0:0:0:0: [sda] tag#0 CDB: opcode=0x28 28 00 00 00 0c 00 00 04 00 00
[ 1286.049165] sd 0:0:0:0: tag#4 uas_eh_abort_handler 0 uas-tag 5 inflight: CMD
[ 1286.049173] sd 0:0:0:0: tag#4 CDB: opcode=0x0 00 00 00 00 00 00
[ 1286.065838] scsi host0: uas_eh_device_reset_handler start
* Same issues as discussed in this post.
* Fixing this on libreelec was a bit different though, hence why I wrote this post.
* Navigate to root after logging in, ensure you can edit the `/flash/cmdline.txt` by remounting, then edit file.
CODE: SELECT ALL

cd ..
mount -o remount,rw /flash
nano /flash/cmdline.txt
* I simply adding the below to the beginning of the file and saved:
CODE: SELECT ALL

usb-storage.quirks=152d:1561:u
* And then rebooted:
CODE: SELECT ALL

reboot
* After rebooting I checked that the quirk was applied:
CODE: SELECT ALL

dmesg | grep usb-storage
[ 0.673330] usbcore: registered new interface driver usb-storage
[ 1.024033] usb 2-1: UAS is blacklisted for this device, using usb-storage in stead
[ 1.024147] usb 2-1: UAS is blacklisted for this device, using usb-storage in stead
[ 1.024163] usb-storage 2-1:1.0: USB Mass Storage device detected
[ 1.024576] usb-storage 2-1:1.0: Quirks match for vid 152d pid 1561: 800000
[ 1.024726] scsi host0: usb-storage 2-1:1.0
* Which it was, and I then retested the performance:
CODE: SELECT ALL

LibreELEC:~ # hdparm -t /dev/sda1

/dev/sda1:
Timing buffered disk reads: 930 MB in 3.00 seconds = 309.71 MB/sec
* A 20x improvement and it runs so much better. So thank you for this sticky. 🙂

Mouse double click speed

Trouble like me with Mouse double click speed?

Google “lxde double click speed”, there is a hidden file named “.gtkrc-2.0” in your home directory. So if it does not exist, create it. If it does exit, read it before you proceed — it may advise you to use “.gtkrc-2.0.mine” instead.
Type these commands from the prompt, or inside LXTerminal.

sudo nano ~/.gtkrc-2.0

Add the following line:

gtk-double-click-time=1000

Press Ctrl – X, y and enter to save and quit the editor. Logout of the desktop and startx again for it to take effect.

Install Freepascal/Lazarus again

For Buster see here!

Installed using instructions from several posts by Thaddy as follows:

1. Add stretch-backports to sources.list

Create:   sudo nano /etc/apt/sources.list.d/backports.list
Add:      deb http://ftp.debian.org/debian stretch-backports main

Update:   sudo apt-get update

Ignore complaints about not signed

2.  FPC 3.0.4 and Lazarus 1.8.4 are both in stretch-backports

Use apt or apt-get, need to install with the -t option.
Answer Y to install without verification.

sudo apt-get -t stretch-backports install fpc
sudo apt-get -t stretch-backports install lazarus

Ignore complaints about not verified

Virtuino

Control Arduino from Android app.

Over Ethernet, Bluetooth, ESP8266

http://users.sch.gr/iliaslamprou/index.php/en/tutorials-getting-started/75-virtuino/115-virtuino-arduino-uno-esp8266-example

 

Stretch and network names

The Raspbian Stretch network interface name is generated from your MAC address for that interface and it’s no longer easy to guess. While this was done to please the enterprise Linux users and their behemoth alike setups, it’s game breaking for many of us – Raspberry Pi users. Each time a piece of code would refer to the interface by eth0/wlan0 – it fails miserably on the new Raspbian Stretch.

Solution

The best solution to this is to disable the Raspbian Stretch network interface name changes at the boot level. You can do this by removing the SD card and adding this line to the cmdline.txt file:

net.ifnames=0

This will disable the new way of naming things and restore the old settings. You don’t have to reinstall the Stretch again. The changes will apply after the next reboot.