Tuesday, December 31, 2013

"Uncreative Writing"?

I heard a discussion on "Uncreative writing" from the "On the Media" fro NPR. Host Brooke Gladstone and her guest Kenneth Goldsmith discusses plagiarism. What interests me is what Kenneth Goldsmith's experiments, that includes the "Uncreative Writing" course he has been teaching. See the course description on his website at

The radio episode I was listening is
that also includes the transcript of the program.

Goldsmith has a book bearing the name of "Uncreative Writing".


Find more  of Goldsmith's work at his website at,

Story Told in Photos ... "Faces of Addiction"

I heard the story about Chris Arnade's photographic work, called "Faces of Addiction". I checked it out when I got back to my computer. It was an indeed powerful story. His photographic work has been actually widely reported. Check his work out at Flickr. 

Several related ...

Friday, December 13, 2013

Octave Complains About Termnial ...

When I ran most recent version of octave after the compilation and installation on an Ubuntu host, I observe the following problem,


octave:99> set terminal aqua enhanced title "Figure 1"  font "*,6"
                        ^
     `line 0: unknown or ambiguous terminal type; type just 'set terminal' 
for a list`

Web searches directed me either to add setenv('GNUTERM', 'x11') to $HOME/.octaverc or do add the environment variable in shell, e.g., export GNUTERM=x11. Unfortunately, it did not solve my problem. It turns out the message comes from gnuplot since octave uses gnuplot to plot. To fix the problem, we can install the gnuplot-x11 package, i.e.,
sudo apt-get install gnuplot-x11 

Monday, December 9, 2013

VMWare Tools Failed to Load on Ubuntu 13.10 (Saucy)

I am running a Ubuntu guest OS using VMWare Player. I upgraded my guest Ubuntu to Ubuntu 13.10 through "do-release-upgrade" and upgraded my VMWare player to 6.01. When I was upgrading the VMWare Tools, I encountered a problem that the VMWare Tools cannot be loaded. I did a quite a few web searches and many suggested to disable the vmware-tools-thinprint service. On my guest, it did not help by disabling the vmware-tools-thinprint service. What actually helped was to upgrade vmxnet to vmxnet3, which can be accomplished by directly editing the virtual machine's configuration file. To edit the configuration file, in my case the Ubuntu.vmx file, add a line to the file, e.g.,


ethernet0.virtualDev = "vmxnet3"


The solution was hinted by the error message when I ran vmware-install.pl,


The vmxnet driver is no longer supported on kernels 3.3 and greater. Please 
upgrade to a newer virtual NIC. (e.g., vmxnet3 or e1000e)

In some case, as indicated by the comment below, you may also need to uninstall (by running vmware-uninstall-tools.pl that should have been installed, by default at the /usr/bin directory) and reinstall VMWare tools.

Thursday, November 21, 2013

Octave Forge's Audio Package on Windows

To use the sound and soundsc functions in Octave, we can install the audio package in Octave Forge by installing the package in Octave -- depending on how you installed Octave, you may need administrative privilege.


octave: 1> pkg install -forge audio
 
On Linux systems, there is no problem at all. However, when I tried to duplicate the experience on Windows, I ran into a problem. Namely, when I run the "sound" function, I keep getting the error,

error: sound.m: No command line utility found for sound playing

Examining the sound.m, we see the following code,

  ## What do we use for playing?
  global sound_play_utility;
  if ~isempty(sound_play_utility),
    ## User specified command
  elseif  (file_in_path(EXEC_PATH, "ofsndplay"))
    ## Mac
    sound_play_utility = "ofsndplay -"
  elseif (file_in_path(EXEC_PATH, "play"))
    ## Linux (sox)
    sound_play_utility = "play -t AU -";
  else
    error("sound.m: No command line utility found for sound playing");
  endif

It looks that Octave needs an audio player that can play audio data piped from the standard input. A little bit web search, I found the answer. Here is the summary what I did,
  • Download sox Windows 32 binary from http://sourceforge.net/projects/sox/files/sox/
  • Install sox
  • Go to sox's installation directory, make two copies of sox.exe, one copy named as play.exe, and one named as play (without extension). From Windows command line, you would do the following,
    
    copy sox.exe play.exe
    copy sox.exe play
    

  • Update the Octave shortcut (.LNK) file by adding command line option "--exec-path "C:\Octave\sox-14-4-1". Replace sox's path with your own. 
  • Run Octave
  • Test it by playing some random noise, such as,
    
    Octave:1> y = rand(1, 10000);
    Octave:2> sound(y, 44100);
    

    You should hear the noise.

Thursday, October 24, 2013

Free GUI Applications for LaTeX (WYSIWYM)?

For those who do not want to memorize syntax and commands, a few applications with GUI can produce LaTeX documents,


Among the above, only LyX is free with a GPL license. Wikipedia has a comparison page for TeX editor.  

Wednesday, October 23, 2013

Remove Old Linux Kernel Images in Ubuntu from Command Line

As you upgrade your Ubuntu Linux, the number of different versions of Linux kernel images grow. The Linux kernel images can occupy quite some disk space. Your /boot file system may be short of space for future upgrades of Linux kernels. It may look for a method to remove the old Linux kernel images. The following discussion suggests that we remove old kernel images using "Synaptic Package Manager",


However, it requires a graphical user interface. I am more interested in removing the old Linux kernel images using command line tools only, as sometimes, I simply do not have the luxury of running a GUI. However, the discussion above indeed a good guide. I simply follow the steps below,

  1. Find the versions of Linux kernel images and their packages.

    You may first list the content of the /boot directory, which gives you an idea what kernel images are installed. Then you can use dpkg to find out the package names. Here is an example,
    userfoo@ubuntu:~$ dpkg -l | grep linux | grep 3.0
    ii linux-image-3.0.0-12-generic 3.0.0-12.20 i386 Linux kernel image for version 3.0.0 on x86/x86_64
    userfoo@ubuntu:~$

    In the above, I am looking for "3.0" because I figured from listing the content of the /boot directory that I have a Linux image of version of 3.0.0 installed. The above tells me that the corresponding package of the Linux image is "linux-image-3.0.0-12-generic".
  2. Remove the Linux image package.

    I remove the above Linux image package using apt-get.
    userfoo@ubuntu:~$ sudo apt-get remove linux-image-3.0.0-12-generic
Repeat the above steps for other versions of old Linux images. Typically, as suggested by many other people, you want to keep at least one or two old Linux image to fall back on in case there is an issue with your newest Linux kernel image.

Similar method can be applied to CentOS and Fedora Linux. You can accomplish it using yum alone.


Monday, October 21, 2013

Mounting a Windows Share from Windows 7 in Linux: Mount Error(12): Cannot Allocate Memory

I wanted to mount a network share from a Windows 7 host in Fedora Linux. I encountered a problem below,

[user@fedora]$ sudo mount -t cifs -o username=my-windows-7-username,uid=my-linux-user-name,rw  //windows7host/path-to-network-share /directory-to-mount
[sudo] password for user:
Password for my-windows-7-username@//windows7host/path-to-networshare: ********
mount error(12): Cannot allocate memory
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
[user@fedora]$

A few web searches produced quite a few hits. Most suggest to change "IRPStackSiz"; however, that is not for Windows 7 host. The correct answer is from the "archlinux" site that has a page,
which explicitly states "Note: Googling will reveal another tweak recommending users to add a key modifying the "IRPStackSize" size. This is incorrect for fixing this issue under Windows 7. Do not attempt it." Kudos to that!

For the impatient, run the following as administrator in Windows 7,
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "LargeSystemCache" /t REG_DWORD /d 1 /f

reg add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v "Size" /t REG_DWORD /d 3 /f
Then reboot the Windows 7 host.




Sunday, October 20, 2013

The Windows.old Folder

After I upgraded Windows 8 to Windows 8.1, I found a Windows.old folder that occupied more than 1 GB disk space.

Here is what Microsoft says about the folder,


Wednesday, October 9, 2013

Massively Open Online Courses

This just serves as a bookmark for the leading websites offering Massively Open Online Courses (MOOCs). I found many good computing courses.

Coursera
Udacity
edX
EduKart

Sunday, October 6, 2013

Join Multiple Video Files

I wanted to join a few .mp4 video files together on a Linux host using free software.With my limited experience with avconv (and ffmpeg) and some web search, I attempted to join the .mp4 files using the following command,
avconv -i concat:1.mp4\|2.mp4\|3.mp4 all.mp4
Unfortunately, the above command did not produce the expected result. It threw an exception and stopped at the end of the first .mp4 file, which was also observed by a few frustrated users, e.g.,

The reason turns out to be that the concatenation operation cannot be performed on .mp4 file, which is also suggested in the answer to the last of the three examples above.

The solution to the problem is in fact included in the FAQ of libav and that of ffmpeg, which is suggested by a stackoverflow post and answer.  Below is how I actually got it done,
avconv -i 1.mp4 1.mpeg
avconv -i 2.mp4 2.mpeg
avconv -i 3.mp4 3.mpeg
cat 1.mpeg 2.mpeg 3.mpeg | avconv -f mpeg -i - -vcodec mpeg4 -strict experimental output.mp4
or
ffmpeg -i 1.mp4 1.mpeg
ffmpeg -i 2.mp4 2.mpeg
ffmpeg -i 3.mp4 3.mpeg
cat 1.mpeg 2.mpeg 3.mpeg | ffmpeg -f mpeg -i - -vcodec mpeg4 -strict experimental output.mp4
This solution is also suggested by a few posts, such as, this one, this one.

If you observe quality degradation in the resulting video, you may add the "-qscale" option, such as,
avconv -i 1.mp4 -qscale 1 1.mpeg
where the value of qscale is between 1 and 0 with 1 being the highest quality (also the largest file) and 0 being the lowest quality (also the smallest file).


Note that many web posts, when discussing the tools, refer the "sameq" option, which apparently not supported any more, as discussed here.

By the way, when I was looking for a solution to the "join-mp4-vidoe" problem, I happened to come across a post on the history of libav and ffmpeg that I enjoyed reading and that answers my question, "why are there two almost identical but different libraries and tools, libav and ffmpeg?"





Sunday, September 29, 2013

Convert VirtualBox VDI to VMWare VMDK

You can run virtual machine instances created in one virtualization software in another. QEMU is a good tool to do this. The following example converts a VirtualBox VDI file to a VMDK file that can be loaded in VMWare.

I did the conversion on a Windows host. You can download the precompiled Windows binaries of QEMU, provided by Prashant Satish,  or those provided by Eric Lassauge.

The procedure is the same in Linux hosts.

  1. To convert VirtualBox virtual appliance to a VMDK file.
    qemu-img convert  virtualbox.vdi  -O vmdk vmware.vmdk
  2. If you have VMWare Workstation or more luxury version, you can start with creating a new virtual machine. During the process, you have the option of selecting an "existing disk". In this case, you simply select the .vmdk file.

    However, I would like to stick to the free VMWare Player that does not provide the option of selecting an "existing disk". I have to use a workaround.

    Start VMWare Player, then create a new virtual machine, for instance, a virtual machine called "vboxvmware".  You must select "I will install the operating system later." option as the two images show. 



    Since you created or downloaded the VirtualBox virtual machine, you should know what guest operating system it is and what memory capacity is allocated. Choose them accordingly.



    Next step, choose the option of "Store Virtual Disk as a Single File".


    Upon confirming your choice, you will see that the virtual machine is created.



    The last step is to edit the VMWare virtual machine configuration file (.vmx file). Go to the directory where the virtual machine is located, locate the .vmx file, and edit the file using your favorite text editor. In the editor, locate the line of "scsi0:0.fileName = ..." and replace the virtual disk file by the .vmdk file previously converted using QEMU. Note that when you edit the file, make sure the path of the .vmdk file is correct if it is not copied to the directory. Then, you can safely remove the vboxvwmare.vmdk file that your virtual machine does not really use. You can then safely launch the virtual machine from the summary screen.



Thursday, September 26, 2013

Tracing System Calls and System Events

I found strace and ltrace were good tools on Linux to diagnose many problems.

On Windows, similar tools actually exist. The equivalent to strace, perhaps is, Process Monitor and that to ltrace, Logger and LogViewer.

 In addition, Windows' event instrumentation is useful.

A good article is http://jbremer.org/intercepting-system-calls-on-x86_64-windows/ . The post is based on the discussion at http://stackoverflow.com/questions/3847745/systrace-for-windows.




Tuesday, September 24, 2013

Web Pages Never Expire

Heard this website http://perma.cc from Marketplace Tech. "Some of the most prestigious institutions in the country are taking efforts to create a new, permanent archive of scholarly work online. new, permanent archive of scholarly work online" as it states. Sounds quite interesting.The site is still in beta -- I hope that it will go alive soon.

Sunday, September 15, 2013

Physical Address Extension (PAE) on 32-bit Windows

One friend complains to me that his company issued computer has more than 4GB physical memory but the system property shows that he can only access 3GB. This information can be revealed from Windows Control Panel (Control Panel\System and Security\System on Windows Vista and above).  It shows you how much physical memory installed and how much the operating system can get access to. If you have a 32-bit Windows installed, like my friend, your system can address up to 4GB physical memory. Microsoft provides memory limits for various Windows releases. See the page. What makes the situation worse is that your 32-bit Windows typically can access even less than 4GB memory. It happens when some of I/O devices are operated using memory-mapped I/O. You may refer to Microsoft Knowledge Base KB929605 for more detailed discussion.  However, I simply cite the "cause" section as follows,

Various devices in a typical computer require memory-mapped access. This is known as memory-mapped I/O (MMIO). For the MMIO space to be available to 32-bit operating systems, the MMIO space must reside within the first 4 GB of address space.

For example, if you have a video card that has 256 MB of onboard memory, that memory must be mapped within the first 4 GB of address space. If 4 GB of system memory is already installed, part of that address space must be reserved by the graphics memory mapping. Graphics memory mapping overwrites a part of the system memory. These conditions reduce the total amount of system memory that is available to the operating system.

The reduction in available system memory depends on the devices that are installed in the computer. However, to avoid potential driver compatibility issues, the 32-bit versions of Windows Vista limit the total available memory to 3.12 GB. See the "More information" section for information about potential driver compatibility issues.

If a computer has many installed devices, the available memory may be reduced to 3 GB or less. However, the maximum memory available in 32-bit versions of Windows Vista is typically 3.12 GB.

Oops! How would I access more the rest of physical memory then? The memory is important to system performance. Of course, you may upgrade your Windows to a 64-bit version. However, you may avoid the hassle by enabling Physical Address Extension (PAE) on your 32-bit Windows. Microsoft has an entry (aa366796) on PAE in MSDN library. To make it simple, you may following the following steps on your 32-bit Windows,

  1. Run a Windows command window as  administrator. (Search cmd, then right click on the short cut, choose Run as Administrator)
  2. In the command window, run

    bcdedit /set pae ForceEnable

    which allows Windows on x86-based systems to access up to 64 GB or 128 GB of physical memory, depending on the physical address size of the processor.Wikipedia has a table that lists the physical address bus size.


Friday, September 13, 2013

Vim as Hex Editor


Vi Improved (vim) is a great tool. It can serve as a good Hex editor if the file you are viewing is not too big.

Once you open a file using Vim, use command %!xxd to enter hex mode. To exit hex mode, use %!xxd -r.

Thursday, September 12, 2013

Emulating LaTeX Look & Feel in Microsoft World

Following the instruction , you can find a Word template and the URL to Computer Modern fonts that should be used along with the template.

Using the template and the fonts, you can generate Word documents that remarkable resemble those generated using LaTeX.

I found downloading the fonts manually a pain since there are many. Perhaps, a simpler way is to use a shellscript, which I ran on an Ubuntu Linux guest OS,

wget http://www.ctan.org/tex-archive/fonts/cm/ps-type1/bakoma/ttf/ -O - -q | \
    grep "mirror.*ttf" | \
    sed -e 's/^.*href=\"//g' | \
    sed -e 's/\" title=.*$//g' | \
    xargs wget -c -nv

Well, it may not be a script since it is just a one-liner. If you are unfamiliar with Unix/Linux shells, note that there is no space after "\" that simply indicates a line continuation







Thursday, September 5, 2013

Testing Exchange Server Connectivity


To test Microsft Exchange servers, Microsoft has a service that can help. The service is at 
which allows you to test the connectivity between your host and a Microsoft Exchange server.

Even if you are not setting up an Exchange server, the service can help you determine what configuration that your Exchange e-mail provider may be, e.g., does it work with Windows Mail? does it provide the Outlook Anyware connectivity?



Monday, September 2, 2013

Linux Capabilities

It had been for a long time that processes' permission on UNIX/Linux systems are differentiated into two categories, privileged or non-privileged processes. The effective user ID of privileged processes is 0 while that of non-privileged processes is nonzero. User ID 0 belongs to the superuser or root. Such a granularity were viewed as too coarse by many. Starting from Kernel 2.2,  Linux introduces the concept of capabilities that divides the privileges that traditionally associated with superuser into many categories. Linux manual page Capabilities has a good discussion on this topic.

Apparently,  many Linux programmers do  not seem to have a good understanding on this new development. Michael Kerrisk has statistics on the usage of different Linux capabilities. Perhaps, it is easier to get what you need by just assuming the privilege of the superuser than figuring out what you do not really need, which requires perhaps higher cognitive load and activity.

This post demonstrates a few usage of capabilities from an application programmer point of view. 

Packet Socket

Packet socket requires that the opening process has effective UID 0 or the CAP_NET_RAW capability. The following example program sends a message over an Ethernet.

#include <arpa/inet.h>
#include <net/ethernet.h>
#include <netinet/ether.h>
#include <netpacket/packet.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
    int sockfd;
    struct sockaddr_ll dest_addr;

    if (argc < 3) {
        printf("Usage: %s destination_host message\n", argv[0]);
        exit(0);
    }

    sockfd = socket(AF_PACKET, SOCK_DGRAM, htons(ETH_P_ALL));

    if (sockfd == -1) {
        perror("Error calling socket(AF_PACKET, SOCK_DGRAM ...): ");
        exit(1);
    }


    /* When you send packets it is enough to specify sll_family, sll_addr,
     * sll_halen, sll_ifindex. The other fields should be 0. */
    memset(&dest_addr, '\0', sizeof(dest_addr));

    dest_addr.sll_family = AF_PACKET;
    dest_addr.sll_ifindex = 1;
    dest_addr.sll_halen = ETH_ALEN;

    if (ether_aton_r(argv[1],
            (struct ether_addr*)&(dest_addr.sll_addr)) == NULL) {
        fprintf(stderr,
            "Error: %s is not in the hex-digits-and-colons format.\n",
            argv[1]);
    }

   if (sendto(sockfd, argv[2], strlen(argv[2]), 0,
            (struct sockaddr*)&dest_addr, sizeof(dest_addr)) == -1) {
        perror("Error calling sendto(...): ");
        exit(1);
    }

    printf("Info: packet sent successful\n");

    close(sockfd);
    return 0;
}

The program takes two command line arguments. The first argument is the Ethernet address of destination host and the second argument is the message to send.

When you run it as a non-privileged user, for instance, as follows,

        $ ./sendpacket 00:0c:29:89:7a:4d "Hello, World"

you would receive an "Operation not permitted" error,

       Error calling socket(AF_PACKET, SOCK_DGRAM ...): : Operation not permitted

Two methods that we can use to make it work. First, run it under root, the traditional method,

        $ sudo ./sendpacket 00:0c:29:89:7a:4d "Hello, World"
        Info: packet sent successful

A new method, which is a better and preferred method, is to give the program minimal but necessary privilege -- since the packet socket requires the program with CAP_NET_RAW privilege, we ought to give the program the privilege, but only the privilege.

However, before that, let us check what privilege the program has,


        $ /sbin/getcap ./sendpacket

It outputs nothing, which means the program does not any privilege. Now we can give the program the privilege by

        $ sudo /sbin/setcap cap_net_raw=ep ./sendpacket

Now check the program's privilege again,

        $ /sbin/getcap ./sendpacket
        ./sendpacket = cap_net_raw+ep

Now the output indicates that the program has its effective privilege set as  CAP_NET_RAW. Run the program again as a non-privileged user,

        $ ./sendpacket 00:0c:29:89:7a:4d "Hello, World"
        Info: packet sent successful


Notable Issues

When I tried to set capability for the program on a Virtual Machine, I received an error:

        Failed to set capabilities on file `./sendpacket' (Operation not supported)

This is because that the file system that the file was on is actually a VMWare HGFS that moutns a Windows NTFS. The Windows NTFS does not support the security capability. When I copied the file to an ext4 file system, the problem went away.

libcap Library

For programming Linux capabilities, you need the libcap library.

On Ubuntu,

          sudo apt-get install libcap-dev

On CentOS/Fedora Linux,

          sudo yum install libcap-devel


Reference and Further Reading

  1. http://www.cis.syr.edu/~wedu/seed/Labs/Documentation/Linux/How_Linux_Capability_Works.pdf
  2. http://man7.org/linux/man-pages/man7/packet.7.html
  3. http://www.linuxjournal.com/article/5737
  4. http://ols.fedoraproject.org/OLS/Reprints-2008/hallyn-reprint.pdf
  5. http://www.cis.gvsu.edu/~kalafuta/cis458/f12/labs/lab3.html

Sunday, September 1, 2013

Search Windows Drivers for Unknown/Other Devices Online

It is often that we encounter the problem of unidentified devices in Microsoft Windows. A web search, perhaps, is the most common method to locate the drivers for the devices.

Having located Windows drivers for a few "other device" or "unknown devices", I learned that the correct method to do the web searches is to use the devices "Hardware Ids" listed under the "Details" tab of the selected device in Windows Device Manager. See the figures below.



Basically, you ought to open Windows Device Manager from Control Panel, right click on the unknown device or other device, then select Properties.  Click the Details tab, choose Hardware Ids from the dropdown box, and press CTRL-C to copy the details shown under  the Value box. Then, press CTRL-V in a web search box along with model and maker of your computer. In this particular, example, I entered,

USB\VID_138A&PID_003C HP EliteBook 2760p driver

The first two returned results would give you sufficient information to locate the driver for the "uknown device", which is, in fact, a Validity Fingerprint sensor.



Other Devices/Unknown Devices When Installing Windows 8 on HP Elitebook 2760p

Having installed Windows 8 on an HP Elitebook 2760p, found the following unrecognized devices in Windows Device Manager,
  • Other devices
    • Base System Devices
    • Unknown devices
The "Base System Devices" has the following hardware ids,
   Hardware Ids
     PCI\VEN_197B&DEV_2392&SUBSYS_162A103C&REV_30
     PCI\VEN_197B&DEV_2392&SUBSYS_162A103C
     PCI\VEN_197B&DEV_2392&CC_088000
     PCI\VEN_197B&DEV_2392&CC_0880


The "Unknown Device" has the following hardware ids,
   Hardware Ids
     USB\VID_138A&PID_003C&REV_0086
     USB\VID_138A&PID_003C


These two devices actually are

For convenience you may download the drivers for different versions of Windows below:
    HP Elitebook 2760p Drivers for Windows.



Saturday, August 31, 2013

Obtain MAC Address of Ethernet NIC in Linux

Linux manual page netdevice(7) has good description on ioctl's that one may use to control or query Ethernet NIC.

The following sample program returns the Ethernet adapter's MAC address from its interface name.

#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>         /* declares IFNAMSIZ */
#include <net/if_arp.h>     /* declares types of link, such as, APRHRD_ETHER */
#include <net/ethernet.h>   /* declares ETH_ALEN */
#include <netinet/ip.h>     /* declares IPPROTO_IP */
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>

int main(int argc, char *argv[])
{
    int sockfd, i, addrlen;
    struct ifreq ifr;

    if (argc < 2) {
        fprintf(stderr, "Usage: %s IFNAME\n", argv[0]);
        exit(1);
    }

    /* many network sockets would do, here are 3 examples. */
    /* sockfd = socket(AF_PACKET, SOCK_RAW, 0); */
    /* sockfd = socket(AF_UNIX, SOCK_DGRAM, 0); */
    sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
    if (sockfd == -1) {
        fprintf(stderr, "Error: calling socket(AF_PACKET, SOCK_DGRAM, 0): %s\n",
            strerror(errno));
        exit(1);
    }

    ifr.ifr_name[IFNAMSIZ-1] = '\0';
    strncpy(ifr.ifr_name, argv[1], IFNAMSIZ-1);

    if (ioctl(sockfd, SIOCGIFHWADDR, &ifr) == -1) {
        fprintf(stderr, "Error: calling ioctl(sockfd, SIOCGIFHWADDR, ...): %s\n",
            strerror(errno));
        exit(1);
    }

    switch(ifr.ifr_hwaddr.sa_family) {
        case ARPHRD_ETHER:
            addrlen = ETH_ALEN;
            break;
        default:
            fprintf(stderr, "Warn: not Ethernet, give up ...\n");
            exit(1);
    }

    for (i=0; i<addrlen-1; i++)
        printf("%02x:", (unsigned char)ifr.ifr_hwaddr.sa_data[i]);
    printf("%02x\n", (unsigned char)ifr.ifr_hwaddr.sa_data[addrlen-1]);

    close(sockfd);
    return 0;
}

Other Devices/Unknown Devices When Installing Windows 8 on HP Probook 6550b

I found three unknown devices when I installed Windows 8 on a HP Probook 6550b. The three unknown devices are actually,

  • JMicron Media Card Reader Drive
       Hardware Ids
         PCI\VEN_197B&DEV_2392&SUBSYS_1619103C&REV_30
         PCI\VEN_197B&DEV_2392&SUBSYS_1619103C
         PCI\VEN_197B&DEV_2392&CC_088000
         PCI\VEN_197B&DEV_2392&CC_0880
       Hardware Ids
         USB\VID_138A&PID_003C&REV_0086
         USB\VID_138A&PID_003C

  • HP 3D DriveGuard
       Hardware Ids
         ACPI\VEN_HPQ&DEV_0004
         ACPI\HPQ0004
         *HPQ0004

  • Validity Fingerprint Sensor (VFS471)
        Hardware Ids
          USB\VID_138A&PID_003C&REV_0086
          USB\VID_138A&PID_003C)


The problem was resolved by downloading and installing three drivers, respectively.

Note that at the time I was installing Windows 8 on the laptop, Windows 8 driver for Validity Fingerprint Sensor was not available on HP's website. I tried the Windows 7 driver and it worked just fine.

After the drivers were installed, you would find the devices listed as follows in Windows Device Manager,
  • JMicro Media Card Reader Driver as "Memory technology devices\JMicron PCIe SD Host Controller" and "Memory technology devices\JMicron PCIe SD/MMC Host Controller"
  • HP 3D DriveGuard as "System devices\HP Mobile Data Protection Sensor"
  • Validity Finterprint Sensor as "Biometric devices\Validity Sensor"

For convenience you may download the drivers for different versions of Windows below: