- 2016-09-30 - 2016/09/30/Pairing-a-Logitech-MX-Master-Mouse-with-Ubuntu-16-04-Using-Bluetooth/

Compared to when I used to download 3.5” floppy disk install images to set up Slackware on my machine, Linux has grown by leaps and bounds in terms of usability.  The majority of things seem to “just work” these days.  However, every once in awhile I run into some kind of weird issue.

In this case, I wanted to pair my MX Master Wireless Mouse with my Lenovo laptop running Ubuntu 16.04.  I don’t use the unifying receiver (which, to be honest, I don’t even know if I still have) because I generally just pair with Bluetooth so I have one less dongle to mess with.  That’s even more important in the case of a small laptop that doesn’t have a lot of USB ports to spare.

Adding a bluetooth device is theoretically pretty straightforward.  Go into the bluetooth settings and click “Add Device” while the mouse is in pairing mode.  It actually finds the MX Master just fine, and even claims to complete the pairing process.

However, it still doesn’t recognize the mouse, and the LED for the connection is still blinking instead of staying solid.  After a lot of googling, I finally found a solution that worked for me.  Once you have gone through the regular pairing procedure, enter the following commands (as root):

hciconfig hci0 sspmode 1
hciconfig hci0 down
hciconfig hci0 up

Voila, a working mouse!

Author: Eric Asberry
URL: https://a42.us/2016/09/30/Pairing-a-Logitech-MX-Master-Mouse-with-Ubuntu-16-04-Using-Bluetooth/
- 2016-09-18 - 2016/09/18/Quick-tip-for-joining-lines-with-a-separator-in-vim/

Every so often I need to deal with some exported database id’s that come in the form of a CSV file.  The trouble is, instead of having the id’s one per line, I really need them on a single line, comma-separated so that I can use them in an IN clause in some kind of query.  I always remember this is easy to do in vim, but I can never remember the syntax.  So here it is, for my (and maybe somebody else’s) future reference:


: to enter command mode
% to select all lines
Then the substitute command to search and replace all newlines in the selected block with a comma.  

Of course you could use the pipe character or whatever other delimiter you need in place of the comma.

Now that I’ve written it down somewhere hopefully I’ll never forget it!

Author: Eric Asberry
URL: https://a42.us/2016/09/18/Quick-tip-for-joining-lines-with-a-separator-in-vim/