Monthly Archives: May 2011

find /

After nearly half a decade, I visited Palam again. I wanted to take this trip a bit early, for a special reason, but my luse^H^H^Haziness preëmpted it, and now that reason isn’t anymore :P. Anyways, since most of the friends are married, or are in process of getting married, I feel a bit awkward to hang out with them, so this time I decided to troll the streets alone by myself. And also as this is a completely unannounced visit, there is very less chance to catch them.

The place had undergone a major overhaul. Lots of artifacts (of that time) are destroyed, re-built. Streets are narrowed, paths were altered, but thankfully roads are still uneven. It has become a mess and finding my way in this mess was fun, but it was really disheartening to see it like that. I visited a couple of places where I was regular at one time, to see if they still recognize me, but none-of-them recognized me, except for one person :).

So, after fed up of trolling streets, and waiting on the corner of street hoping for someone to see me from their balcony, recognize me, call my name, I decided to call Rahul, who as I expected wasn’t at his place ;). Considering, it as fate, I decided to take bus back to Metro station, but then thought at least I should check out my school, so I decided to take the shortcut to school. The shortcut proved real short this time, unlike a bit longer when I used to take it daily 9 years ago. I’m not sure what made it look shorter, maybe the obscurity introduced in paths, or is it the zeal of find / ;). The school, which at that time was recognizable from far, is now unrecognizable due to even taller structures grown around it. Anyways, I didn’t enter school this time.

I wanted to meet Arun, who once called from .au years ago to surprise me, and IIRC my response wasn’t at all cool :(. I haven’t heard from him since then. Nor I heard any news of Puneet, so I decided to show up at Puneet‘s shop and probe about Arun as well. I went outside at Puneet‘s shop, and luckily he was there. We chatted for few minutes, and he mentioned about getting a gold medal for MCA from IGNOU, most crazy thing :P. He mentioned Arun is also in India, so from there we went to Arun‘s place. Arun had some health issues recently, but was looking cheerful as usual. We refreshed lots of old memories, which of course aren’t safe to post here ;). It really felt great to physically see him after a long time. He is one of my good friends I’ve in school, although I never realized it while in school, but looking at it now seems the one whom I considered my best friends don’t even talk to me. I wish he recover soon, and live n! years, where n is his favorite positive integer :).

Lastly I wanted to meet Dinu, but since I was running out of time, and it started raining as well, and realized, that was probably his time to go back to work, so decided not to call him. I wish I’d made this trip earlier, c’est la vie.

Anyways, too much nostalgia, time to shut up and hack, after all this’s what I’m here for.

Default sound device in FreeBSD

I’ve an nVidia Graphics card in my FreeBSD box, and snd_hda.ko detects audio device on it as well. But the problem is, the audio interface is masked on the card, so there are no physical audio sockets on the card.

chateau.d.if!abbe:~ % cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64)
Installed devices:
pcm0: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play) default
pcm1: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm2: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm3: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm4: <HDA Realtek ALC889 PCM #0 Analog> (play/rec)
pcm5: <HDA Realtek ALC889 PCM #1 Analog> (play/rec)
pcm6: <HDA Realtek ALC889 PCM #2 Digital> (play)
pcm7: <HDA Realtek ALC889 PCM #3 Digital> (play)

The only problem with this setup is that all of my sound applications which try to use /dev/dsp end up using pcm0, which doesn’t exist physically. The tricky thing is that, there is no /dev/dsp on filesystem, so kernel internally manages accesses to that device node. To switch to on-board audio (i.e. pcm4) as default sound device, I did sysctl hw.snd.default_unit=4, which worked:

chateau.d.if!abbe:~ % cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64)
Installed devices:
pcm0: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm1: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm2: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm3: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm4: <HDA Realtek ALC889 PCM #0 Analog> (play/rec) default
pcm5: <HDA Realtek ALC889 PCM #1 Analog> (play/rec)
pcm6: <HDA Realtek ALC889 PCM #2 Digital> (play)
pcm7: <HDA Realtek ALC889 PCM #3 Digital> (play)

To persist the changes, I added it to sysctl.conf(5). I’ve not rebooted it yet, but I’m sure it’ll work 😉

Setting up MTNL 3G internet connection in FreeBSD

Recently I bought an MTNL 3G internet connection to add some redundancy to my internet connectivity stack. As I use, Following is how I got it running in FreeBSD (8.2-RELEASE) with the help from a similar HOWTO for GNU/Linux.

1. Plugin the device. Following is the dmesg output after plugging in the device (Teracom LW272):

umass0: <6227--Storage> on usbus4
umass0:  SCSI over Bulk-Only; quirks = 0x0000
umass0:0:0:-1: Attached to scbus0
ugen4.2: <D-88n> at usbus4 (disconnected)
umass0: at uhub4, port 1, addr 2 (disconnected)
usb_alloc_device: Found possible auto-install disk (trying next config)
ugen7.2: <HSPADataCard> at usbus7
umass0: <HSPADataCard  > on usbus7
umass0:  SCSI over Bulk-Only; quirks = 0x0000
umass0:0:0:-1: Attached to scbus0
(probe0:umass-sim0:0:0:0): TEST UNIT READY. CDB: 0 0 0 0 0 0
(probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(probe0:umass-sim0:0:0:0): SCSI status: Check Condition
(probe0:umass-sim0:0:0:0): SCSI sense: UNIT ATTENTION asc:28,0 (Not ready to ready change, medium may have changed)
cd0 at umass-sim0 bus 0 scbus0 target 0 lun 0
cd0: <HSPAData CD-ROM 0000> Removable CD-ROM SCSI-0 device
cd0: 40.000MB/s transfers
cd0: cd present [8982 x 2048 byte records]
(probe0:umass-sim0:0:0:1): TEST UNIT READY. CDB: 0 20 0 0 0 0
(probe0:umass-sim0:0:0:1): CAM status: SCSI Status Error
(probe0:umass-sim0:0:0:1): SCSI status: Check Condition
(probe0:umass-sim0:0:0:1): SCSI sense: NOT READY asc:3a,0 (Medium not present)
da0 at umass-sim0 bus 0 scbus0 target 0 lun 1
da0: <HSPAData SD Card 0000> Removable Direct Access SCSI-0 device
da0: 40.000MB/s transfers
da0: Attempt to query device size failed: NOT READY, Medium not present

2. Load umodem kernel module to recognize the modem in the device, no usb_modeswitch (or its equivalent) required:

chateau.d.if!abbe:~ % sudo kldload umodem
Password:
chateau.d.if!abbe:~ % dmesg|tail -4
umodem0: <HSPADataCard USB Modem1> on usbus7
umodem0: data interface 2, has CM over data, has break
umodem1: <HSPADataCard USB Modem2> on usbus7
umodem1: data interface 4, has CM over data, has break

3. Add following lines ppp.conf for dialing, in my case for prepaid connection (APN: gprsppsdel):

mtnl:
        set device /dev/cuaU0  # USB modem device node created after loading umodem
        set speed 460800
        set phone "*99#"
        set authname mtnl
        set authkey mtnl123
        accept PAP
        accept CHAP
        set dial "ABORT BUSY ABORT NO\\sCARRIER \
         \"\" AT OK-AT-OK \
         ATEQV1 OK \
         AT+CFUN=6 OK \
         AT+CGDCONT=1,\\\"ip\\\",\\\"gprsppsdel\\\" OK \\dATDT\\T CONNECT"
        set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.255 0.0.0.0
        add default HISADDR
        disable dns
        disable ipv6cp
        disable mppe
        enable lqr

4. Start dialer:

chateau.d.if!abbe:~ % sudo ppp -ddial mtnl
Working in ddial mode
Using interface: tun0

(wait for 5-10 seconds)

chateau.d.if!abbe:~ % ifconfig tun0
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1500
        options=80000<LINKSTATE>
        inet 59.179.150.204 --> 10.0.0.2 netmask 0xffffffff
        Opened by PID 12379
chateau.d.if!abbe:~ % curl http://checkip.dyndns.org/
<html><head><title>Current IP Check</title></head><body>Current IP Address: 59.179.150.204</body></html>

I’m planning to use it with mpd5, will post the instructions when I’m done setting it up.