Apr 22, 2013 - A working bashrc function without parameter expansion (globbing)


I have noticed that the function I had under my bashrc script to simplify the syntax of the find command wasn't actually working for all cases. When I passed asterisks for the search criteria, I was left with weird findings resulting from parameter expansion (globbing). Here is the failing function (from my home .bashrc):

function findf() {
find $1 -name "$2" 2>/dev/null
Which doesn't work properly for the case mentioned above.

After meddling a little bit with this I was able to have a working "findf" by using an alias just to deactivate globbing (set -f) before calling the function (which I have renamed to avoid conflicting with the alias):

alias findf='set -f; findf_func'
function findf_func() {
find $1 -name "$2" 2>/dev/null
set +f
Deactivating globbing inside the function is not enough because the parameters will be expanded before the first line is executed.

After the find command finishes, globbing can be activated again with set +f.

Apr 18, 2013 - ADB - CPU usage and staggering mouse cursor


After tuning my system to develop an Android app, I noticed that every time ADB (Android Debug Bridge) daemon was started, the mouse cursor (and all graphics for that matter, as well as other I/O tasks like playing music) in my GNU/Linux system would start flickering, staggering, jumping, get slow, I'm not even sure what to call it. Besides that, the CPU usage was always around 2% to 7% (if seen from KSysGuard, lower using ps).
KSysGuard shows the ADB daemon consuming an average 4% CPU time
After monitoring the adb process and system I/O operations, I noticed that the problem was probably related to ADB polling the host USB devices periodically. That made me think of the disastrous xHCI controller from Fresco Logic, which I have in my computer for providing USB 3.0 connectivity, that had already given me problems before.

For now, what I do to avoid this issue when I need ADB is simply unloading the kernel module xhci_hcd:
sudo modprobe -r xhci_hcd
If I didn't want to use my USB 3.0 port I would just blacklist the module.

If you have this issue, post a comment or contact me so we can have a further chat and possibly get more insight.

Mar 13, 2013 - The vmware-usbarbitrator binary closes itself with "Pipe unexpectedly closed."


The binary closes itself after around 5 seconds. If run directly from the terminal it shows the following:
# vmware-usbarbitrator
Pipe unexpectedly closed.

The following command only shows the following:
# vmware-usbarbitrator --info -f
VTHREAD initialize main thread 2 "usbArb" pid 7554

This is caused by an empty /etc/arch-release (owned by filesystem).
To fix it, add a version string to /etc/arch-release in the form of <year>.<month>(.<day>) (e.g. 2013.03.01).

I have added this fix to ArchWiki, the official Arch Linux Wiki where more troubleshooting information is available.

Update (2013/04/17):
I have also added the AUR package vmware-usbarbitrator, which provides a systemd service to automatically run VMware-USBArbitrator on computer startup. This systemd service has now been integrated into a single, feature-complete package: vmware-patch.