FreeBSD Tips

FreeBSD 8: Accessing PTP digital camera

When using FreeBSD 7.x I never had a problem with my Nikon Coolpix L18 using gtkam or digikam. FreeBSD 8 has a re-written usb stack and no longer uses libusb. Once I upgrade my camera stopped working. I spent a few months (of and on) comparing the source code trying to write my own driver all to no avail.

I read a posting from a user having the same problem, only he was successful in getting it to work as root. Amazingly, I had never tried to get it to work as root. I tried and it worked! So I now new it was a permissions problem.

Specifically, the newer usb subsystem creates devices in /dev/usb such as ugen1.2 and creates a syslink in /dev to it. So when my camera is connected it creates:

/dev/usb/ugen1.2.0
/dev/usb/ugen1.2.1
/dev/@ugen1.2 -> /dev/usb/ugen1.2.0

My permission in devfs.rules need to give access to a group so that non-root users can access the ugen devices. I had not updated my devfs.rules since FreeBSD 7.x and it looked like this:

[devfsrules_common=7]
add path 'ad*' mode 666 group operator
add path 'acd*' mode 666 group operator
add path 'pass*' mode 666 group operator
add path 'xpt*' mode 666 group operator
add path 'ugen*' mode 666 group operator
add path 'cd*' mode 666 group operator


The key line being the line containing the 'ugen*' entry. This line needed to be changed for use with the new usb subsystem like so

add path 'usb/*' mode 666 group operator

Now when the camera is plugged in a non-root user can use gtkam or digikam to access the images.

If you're using this method be sure to add

devfs_system_ruleset="devfsrules_common"

to /etc/rc.conf so that the rule set is added.





Xming

Just took this sceenshot of claws-mail running via ssh/Xming from my FreeBSD 8.0 RC1 home workstation on my Windows XP workstation at work.

Xming on WinXP





H264 to DX50 avi using handbrake

Since the time I posted this I found out that handbrake lost it's maintainer for the FreeBSD port. Because of this I just switched to using ffmpeg from the command line itself. So to convert from H264 to avi via ffmpeg only:
ffmpeg -i freebsd_rocks.m4v freebsd_rocks.avi
that will give you and avi with mp2 audio

So your picky and want mp3 audio:
ffmpeg -i freebsd_rocks.m4v -acodec libmp3lame freebsd_rocks.avi

Yeah, but you want to watch you avi files on your stand alone DVD player that will play DIVX encoded videos. Well then the avi file needs to be a DX50 sub format, so try this: ffmpeg -i freebsd_rocks.m4v -vcoded mpeg4 -vtag DX50 -acodec libmp3lame freebsd_rocks.avi

NOTE: certain standalone DVDs can't handle mp3 with variable bit rates, this will create variable bit rate mp3 audio. I have not been able to create constant bit rate mp3 yet. It has to be possible, I just haven't found the correct parameters yet. The only work around I have found is to create mpg files that will play as if they are a VCD, to do that use this command line:
ffmpeg -i freebsd_rocks.m4v -target ntsc-svcd freebsd_rocks.avi



THIS IS THE ORIGINAL POST

I like to download a lot of movies and videos of different types. I have a few DVD players that can play DIVX encoded movies. My first such DVD player to do that was a NAD and it was very fickle on reading the encoded files. The DIVX files need to be encoded with DX50 subformat. I usually use avidemux2 to re-encode the movies I've downloaded. But lately there have been alot of movies encoded using H264 and avidemux2 (at least on FreeBSD 7.2 at the time of this writing 8/26/2009) doesn't handle them well. So I use ffmpeg from the command line here is the simple CLI script to do so:

handbrake -i -o .avi -e ffmpeg -b -E lame

So if you wanted to encoded a movie called freebsd_rocks.m4v it would look like this:

handbrake -i freebsd_rocks.m4v -o freebsd_rocks.avi -e ffmpeg -b 2500 -E lame

You can use any bitrate you like, but I like a higher bitrate of 2500...that's it. Simple!





Screenshots

I was bored, cleaning up my disks and decided to post these screen shots I found

Virtual Box Windows XP Cisco VPN
This is FreeBSD 7.2, OpenBox 3.4.7 running Virtualbox with Windows XP connecting to VPN...

Opera 10
FreeBSD 7.2, OpenBox 3.4.7, Opera 10, Thunar, tint2, Komodo IDE (rolled Up)

PES5
Virtualbox running Pro Evolution Soccer 5 in Windows XP on FreeBSD :)

Screenlets
This shows screenlets running on FreeBSD. I was working on a port, but too many of the widgets are Linux specific.





FreeBSD and OpenBox Themes

I've been using OpenBox 3 on FreeBSD exculsively for almost 5 years now. If you download themes from box-look.org they sometime come in the .obt format. This is the extension that OpenBox uses for it theme format. If you try to import these using obconf a lot of times the just fail to load because of an invalid tar option. I assume this is because most themes are created on Linux systems and the use gnu tar which has different options than tar.
All you have to do is to rename the file with tar.gz extension and use the command

tar -xzf theme_name.tar.gz

to extract the theme.





Conky Config Files

Here are a few different conkyrc files that I have used.
The Last one I used
Conky brown
Conky Flux
Conky Old
Conky Top
Conky xxx
Conky Original

I'll post screenshots of them later