Rockbox USB

USB type A plugUSB in Rockbox land was originally a matter of supporting the USB bridge chips in the first targets we supported (the Archos ones, the irivers and the iAudios).

Since the USB stacks moved into pure software in the used soc chips, Rockbox has (unfortunately) relied on the original firmwares (the so called OF) to provide USB support so that host computers can access the players.

One of the projects in the Google Summer of Code 2007 for Rockbox was to introduce a USB stack and offer native USB support for Rockbox, at least on the PortalPlayer-based targets. These targets were selected because the PortalPlayer chips have been found to have a USB set that is next to identical to the one used in the Freescale i.MX31 and that is fully documented online. Christian Gmeiner took this project to state where it partially works, but not enough to be actually useful to any Rockbox user. Christian’s code was largely based on USB code from the Linux kernel.

Now, long time Rockbox hacker Björn Stenberg enters the stage. Being one of the (original) core guys, he has a firm believe in KISS and as such he has started over on a brand new USB stack implementation that is meant to replace Christian’s and to be smaller, less complicated and quite possibly end up actually working! Björn once wrote the ISD200 support in the USB stack for Linux, so he has been in this neighborhood before…

Segmentation Fault Fix

I got this lovely mail today (sender shall remain nameless and not possible to identify as I have no intention to point fingers). The mail doesn’t mention any project I’m involved in, nor does it say how the guy gets his problem or anything. The question is simply:

I hope that you managed to resolve Segmentation fault. I am having the segmentation problem when I run my Executable, I think it got to do with Remote failure Reply, I am not sure. My executable is build under ARM-Linux. I will be grateful if you can tell me which Library file you included or deleted in order to get rid Of segmentation fault.

I love it. I have no idea what he’s talking about..! Quite likely everything will be evident once just a tad bit more details are revealed.

Linux Sound, part II

Here’s a follow-up on my previous rant about Linux sound still lacking:

I got the advice to try shutting off my on-board audio in the BIOS settings, and indeed I think that’s a great idea as with only one sound card present in the system I figure the chances are much bigger that things would auto-detect and work smoothly.Music Note

Forget that. When I did that, I failed to get any sound at all. Not by default and not after trying one of my alsaconf and aumix tricks. I went back and enabled the on-board sound again, did the insane command line invokes and voila, sound is now back…

Someone mentioned that this situation of course may be different with different distros, and while that may of course be entirely true it really doesn’t matter much to me since I won’t change distro (now) and I would expect Debian to be at least around the distros that do a half-decent job.

Two books on China

Recently I’ve read two books (in Swedish) about China and the Chinese, and I’ll offer some quick reviews on them here.

Mei wenti!Inga problem! : om livet i dagens Kina

(ISBN: 9789127356375, Author: Lilliehöök, Catarina)

This is a 320 page story about the author’s trip to China. She studies Chinese, lives in China, travels around and eventually gets a work there. We get to follow the cultural clashes when a blond Swedish woman faces the (traditional) Chinese. It certainly is interesting and educational, but the book is a bit repetitive towards the end as the main point has already gone through by then. The book is however still a light and fast read.

Vilda svanar – Tre döttrar av Kina

Vilda Svanar(ISBN: 9789151845678, Author: Jung Chang, English title: Wild Swans)

This international best-seller is a 500+ page novel about three generations of Chinese women. The author’s grandma, mother and herself. Starting in the early 1900s over the years and the major changes that the poeple of China went through, all the way to modern time.

While a slightly harder read, I’d say this is much more interesting in comparison to the previous one, and it offers a great insight to why many of the cultural differences mentioned in the first book exist in the first place. It shows a people tormented by their leaders in many different ways, and a people that have learned the hard way to obey whatever they say and to stop thinking by themselves.

download flv videos from youtube

My wife wants to keep some videos found on youtube, and I really can’t recommend just keeping bookmarks to a random web site like that. Not if you want the content to be available in a few years ahead, or even ten or twenty years. Then downloading the files to keep the locally is the only sane way to make it somewhat more reliable.

To download the files you can do it with a browser or with a command line tool:

Browser StyleGreasemonkey

  1. Use Firefox
  2. Install Greasemonkey
  3. Within Greasemonkey there’s concept of user scripts that customize it, and we want a certain customization for youtube pages. So we get the YouTube to me v2 script installed.
  4. Now, each youtube web page gets a red stripe on the top of the page that allows you to download the FLV.

Command Line Style

There exist several command line tools “out there” that do the job. I tried youtube-dl and it did the job splendidly by only proving the main HTTP URL on the command line.

The main lacking feature is that it names the output flv based on the ‘v’ variable in the URL so the downloads end up being named things like “f_8wuVEYMZ8.flv”…

Play the local FLV movies

For this, I can only recommend the lovely VLC media player, available on all modern platforms.

curl vs wget, really

Ok, since people truly and actually often ask me about what the differences are between curl and Wget, it might be suitable to throw in my garbage here and state the main differences as I see them. Please consider my bias towards curl since after all, curl is my baby – but I have contributed code to Wget as well.

curl

  • Features and is powered by libcurl -a cross-platform library with a stable API that can be used by each and everyone. This difference is major since it creates a completely different attitude on how to do things internally. It is also slightly harder to make a library than a “mere” command line tool.
  • Pipes. curl is more in the traditional unix-style, it sends more stuff to stdout, and reads more from stdin in a “everything is a pipe” manner.cURL
  • Return codes. curl returns a range of defined and documented return codes for various (error) situations.
  • Single shot. curl is bascially made to do single-shot transfers of data.It transfers just the URLs that
    the user specifies, and does not contain any recursive downloading logic or any sort of HTML parser.
  • More protocols. curl supports FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE at the time of this writing. Wget supports HTTP, HTTPS and FTP.
  • More portable. Ironically curl builds and runs on lots of more platforms than wget, in spite of their attempts to keep things conservative. For example, VMS, OS/400, TPF and other more “exotic” platforms that aren’t straight-forward unix clones.
  • More SSL libraries and SSL support. curl can be built with one out of four different SSL/TLS libraries, and it offers more control and wider support for protocol details.
  • curl (or rather libcurl) supports more HTTP authentication methods, and especially when you try over HTTP proxies.

wget

  • Wget is command line only. There’s no lib or anything. Personally I’ve always disliked the project doesn’t provide a man page as they stand in the GNU side of this and consider “info” pages to be the superior way to document things like this. I strongly disagree.
  • Recursive! Wget’s major strong side compared to curl is its ability to download recursively, or even just download everything that is referred to from a remote resource, be it a HTML page or a FTP directory listing.A gnu head!
  • Older. Wget has traces back to 1995, while curl can be tracked back no longer than 1997.
  • Less developer activity. While this can be debated, I consider three metrics here: mailing list activity, source code commit frequency and release frequency. Anyone following these two projects can see that the curl project has a lot higher pace in all these areas, and it has indeed been so for several years.
  • HTTP 1.0. Wget still does its HTTP operations using HTTP 1.0, and while that is still working remarkably fine and hardly ever is troublesome to the end-users, it is still a fact. curl has done HTTP 1.1 since March 2001 (while still offering optional 1.0 requests).
  • GPL. Wget is 100% GPL v2, which I believe is going v3 really soon when they release their next release. curl is MIT licensed.
  • GNU. Wget is part of the GNU project and all copyrights are assigned to them etc. The curl project is entirely stand-alone and independent with no organization parenting at all.

This turned out to be a long post and it might in fact be usable to save for the future, so I’m also posting this as a more permanent doc on my site on this URL: http://daniel.haxx.se/docs/curl-vs-wget.html. So possible updates will be done there. Do let me know if you have further evident differences or if you disagree with me on details here!