Dalla Rosa

Posts tagged linux

0 notes &

Bluetooth headset on Linux

One of the Holy Grails for electronic device users is eliminating cables and cords. We first started with remote controls, infrared based mouses, wireless and bluetooth devices.

Even though past are the days when it was difficult to connect to wireless or transfer files to/from your pc using bluetooth, a topic that remains full of mistery and problems is bluetooth audio. 

I bought my first bluetooth headset a few years ago and I tried to connect it to my Slackware notebook and I obviously failed miserably.

After many years I decided to buy a HiFi Wireless Headset, something that would allow to both listen to music and take calls with fair quality. After looking around for a while, I decided to with a friends recommendation and bought a Sony Ericcson MW600/B Wireless headsetimage.

Taking a few lines to talk about the device itself, I just love it. The sound quality for both playing music and calling is great, plus the fact that the earphones are not built-in in the device so if you have a more expensive and higher quality pair of earphones you can use those. The battery life is also great. Sony claims that it can do around 8.5 hours of music playback and I can back that. I can leave to work at 10am today with a full charge, spend a big part of my day listening to music and they’ll only die on me the next day if I don’t charge them during the night. Charging only takes around 2.5 hours. Also it can pair with up to 3 devices (it can connect to up to 2 devices at the same time - one in headset mode and the other  in playback mode)

OK! Let’s get over with the digression and back to the main thing of this post, which is talking about how to get this thing working on your Linux machine.

If you have a fairly new distribution running you won’t have problems pairing your device. Just put and pairing mode and let your Bluetooth manager to the rest. 

On KDE, just Alt+F2 to open the “Run Command” dialog and type Bluetooth Devices (probably bluetooth will be enough)


Use the “search” and “setup” buttons to properly setup your device. I guess you want to use it to listen to audio so much make sure to set it up as a “A2DP Sink (Send audio)” (in some places it might be written as “Audio Sink”).

Ok! After doing that your device is properly connected to your machine and ready to play some music! Then you try it….just to see it fail. What do you have to do? 

Actually we’ve already had to deal with the something similar when we fixed the problems with HDMI audio

We need to let ALSA know that the bluetooth device is there and can be used (or in case you want to, you make it the default device). Let’s see how we do that. 

As root, open the file /etc/asound.conf and add the following lines

What you’re doing is, first adding a control device of the type bluetooth and a pcm device. That should already be enough for you to be able to choose the headset (it will be called “btheadset”) to be the playback device.

Lastly, like with HDMI, applications like Chrome and the Flash Player, they will use the default pcm device so you’ll have to change that too:

pcm.!default {
type plug
slave.pcm “btheadset”

The lines above go into the .asoundrc, in your home directory. (Check the HDMI article for more details)

Filed under bluetooth linux slackware tech audio

0 notes &

RPM Packages: Compilation flags

Since October last year I took over the server management tasks in my project. Unfortunately, those machines are loaded not with Debian but with Scientific Linux (Why SL is one of the great mysteries of universe). 

One of these days I needed to know which were the compilation flags of a package. 


rpm -q --queryformat="%{NAME}: %{OPTFLAGS}\n" PACKAGE_NAME

Long Version:

-q or —query is the flag for querying information about a package.

—queryformat is quite obvious but here it is: use this flag to set the the output format of the query result.

A bit more on —queryformat:

According to the docs:

Query formats are modifed versions of the standard printf(3) formatting.

Ok, how can I get a list of the information I can output?

Again, from the docs:

rpm will print a list of all of the tags it knows about when it is invoked with the —querytags argument.

Kinda weird to be writing about RPM based distributions but oh well, at least I’m not managing Windows servers ;)

Filed under centos linux rpm tech server

1 note &

Fixing garbage text on terminal on Linux and Mac

Sometimes you just happen to cat a binary file and it just messes up your terminal output and all can see and type is garbage.

Normally here you’d just give up and reopen your terminal but here’s another solution: Just type the command below:

 echo -e \\033c

All you’re doing is sending an ESC(033 is the octal version of the ASCII control key “ESC”) + a letter “c” to the console, which is a VT100 command to reset the terminal to its default settings. If you’re curious about other VT100 commands, take a look at this page. You can send them all using

echo -e 

followed by the the codes in ASCII. This works in any VT100 compatible terminal which means that you’re safe to use it on your Linux or Mac machine.

Edit: As some people said in the comments and at G+, you can just use the “reset" command, which is actually doing the above and some more.

To read more about the reset command, check the man pages here.

Filed under linux mac tech terminal vt100 memotoself

0 notes &

plist2ota - Generate OTA Manifests from plists

A friend of mine was in need of a script to automatically generate the OTA Manifests needed to distribute iOS apps internally through the iOS Developer Enterprise License

So I wrote a little Ruby script that uses the plist gem for creating a Ruby Array from the plists information. One limitation I found in the plist gem is that it can’t parse binary plists. Right now I’m working on implementing that in Ruby and see if I can get it added to the gem but, for now, I just added to the package this perl script I found, indicated by this page.

If your plist is a binary one, just convert the plist to XML using the plutil.pl script and then using plist2ota.rb to generate your OTA Manifest. 

The link is here: https://github.com/dallarosa/plist2ota

Requests, issues and sugestions, please use Github’s issues page :)

Filed under plist ota manifest apple ios development tech linux macosx ruby perl

0 notes &

A new resolution: No more 32 bit software for me.

10 years ago, when I started dabbling with linux and later decided to make it my main environment, there were things from the Windows world that I couldn’t let go. Be it games, tools, services. I would spend hours and hours trying to get Wine to work and to run those things I could’nt live without. Until one day I realized that…I could live without them. Since that day I decided that if a tool, a service, a game wasn’t available for Linux it wouldn’t exist for me. 

10 years later, I see myself having the same problem but now regarding 32 bit applications. My notbook has a 64bit processor and I decided to fully use it with the latest 64bit version of Slackware. However, lately I’ve been spending just too much time messing around with my machine to get full multilib support so to get a few a applications working properly (namely Skype) that I ended up having more trouble with conflicting packages then with a proper solution to the original problem.

That led me to a new resolution: I won’t use anything that doesn’t have 64bit support. 

I totally don’t mind compiling packages, I totally don’t mind making patches for stuff. I don’t mind writing my own stuff. However, closed source software, like Skype, don’t really allow me to do any of those things.  Skype 4 came and we still don’t have a package that supports 64bit Linux. So no more skype for me. I’ll still be using it on Android and on Mac but at the same time I’ll be looking for a different solution, one that can offer me a 64bit linux compatible solution.

Filed under linux skype 64bit 32bit software tech

2 notes &

Maximizing and restoring panes in tmux

Recently I gave up on screen for tmux. From the tmux homepage:

tmux is a terminal multiplexer: it enables a number of terminals (or windows), each running a separate program, to be created, accessed, and controlled from a single screen. tmux may be detached from a screen and continue running in the background, then later reattached.

Tmux is screen on steroids. You can customize just everything, from starting applications automatically to the background color to the key bindings. The multi-pane temrinal thing is pretty cool but sometimes you just wanna focus and work in just one fullscreen pane while keeping the ability to switch back to the multi-pane mode.

Originally there are no bindings for (or a simple command) to maximize and restore the size of a pane.

After some googling, I found a perfect solution for the problem and I decided to share it with everyone:

unbind + 
bind + new-window -d -n tmux-zoom 'clear && echo TMUX ZOOM && read' \; swap-pane -s tmux-zoom.0 \; select-window -t tmux-zoom 
unbind - 
bind - last-window \; swap-pane -s tmux-zoom.0 \; kill-window -t tmux-zoom

These will bind the “+” and “-” for maximizing and restoring, respectively. 

My own tmux.conf can be found on github.

(Source: superuser.com)

Filed under tmux terminal multiplexer linux macosx maximize restore