Search

2014 on linux terminal

The following script,when executed, will create 2014 on the linux terminal.



Save the script as "2014.sh" and execute it as follows.

 photo 2014.png


Christmas bell on linux terminal

Run the following script to generate a bell on the linux terminal.





 photo bell.png


Audio/Sound output coming from both speaker and headphones at same time

On installation of a new version of linux it might happen that the audio/sound output keeps coming from the speaker of the laptop even after plugging in a headphone into its socket. The expected behaviour is that when we plug in the headphone, sound should only be coming in the headphone and nothing should be audible from the laptop speakers.

After going over number of possible solutions using available on the net what worked was updating the alsa driver by downloading the latest one from http://www.alsa-project.org/main/index.php/Download

The default version of driver installed was 1.0.23, but the update one available on the site was 1.0.25.

To solve the above mentioned problem download the latest driver source, compile it and install it using the following commands.

Assume that we have downloaded the driver for version 1.0.25 which has the package name alsa-driver-1.0.25.tar.bz2



Please note that the last step will require root permissions.

Now restart the system and the laptop speaker should get muted automatically on plugging in the headphones.


Creating directory under /proc in kernel 3.10 and above

In the post Creating a read write proc entry in kernel versions above 3.10 we saw the creation of read write proc entry. In the post we will see how to create folder under /proc and then create a entry under it.

To create a directory under /proc we can make use of the function



Where

name: is the name of the directory to be created. parent: parent is the name of directory under which the new directory has to be created.

To create a directory named "newparent" under /proc we will first declare a string having the name of the new folder





The NULL is passed for parent as we are creating the folder under /proc.

Once the new folder has been created we need to pass the pointer to struct proc_dir_entry to proc_create. The use of proc_create can be seen in the post



The full code for the module along with proc creation will be as shown below. Please refer to the post Creating a read write proc entry in kernel versions above 3.10 for more details

proc_dir.c



The makefile for the same



Compile and load the module using



If there are no errors then we can find the new proc entry under /proc



Thus we can see that under /proc a new folder called newparent has been created in which the proc entry hello has been created. We can read write to this proc entry like other proc entries



Related posts

Creating a read write proc entry in kernel versions above 3.10

Creating read only proc entry in kernel versions above 3.10.

Creating a proc entry - 1

Quiz Solution

Answers to Quiz based on chapter-4 of book linux device drivers 3rd ed

1. Which of the following config options need to be enabled to be able to debug kernel.
Ans.CONFIG_DEBUG_KERNEL

2.The first argument passed to printk specifies the
Ans.loglevel for the message to be printed

3.The command that can be used to view the kernel logs from user space is
Ans. dmesg

4. The function create_proc_read_entry returns a pointer to
Ans.struct proc_dir_entry

5.The seq file interface is used for
Ans. Passing kernel information to user space

6. Output of strace shows
Ans. The system calls made by a user application

7. In a kernel oops message EIP points to
Ans. The address of the faulty instruction

8. While using gdb for kernel debugging the kernel core file used passed to gdb is
Ans. /proc/kcore

9.Which of the following keys will launch the kdb
Ans. Pause

10. To use kgdb we need two systems connected by a serial cable
Ans. True


Enabling the traditional Alt+tab function in gnome3

In gnome3 the default bechiaviour of Alt + Tab is different from the traditional gnome behaviour. In gnome3 on pressing alt tab, it displays all the applications that are open, but if more than one window of the same application is open then all the windows are clubbed together and only the application is displayed.

 photo gnome3_alt_new.png

To choose between the windows of the same application we need to wait on the required application or click on it and all the windows of that application gets displayed, and we can click on the window we want to open.

On the other hand the traditional alt tab swithches from one application to next in the order in which they were last used.

If we are not comfortable with this behaviour than we can make gnome perform like the traditions Alt+ tab as shown below.

Click on the activites tab and select the application Advanced Settings by typing "Advanced Settings" which will open a window as shown below.

 photo advanced.png

On the left of the panel of the Advanced settings selec the option "Shell Extension" which will open the window as shown below.

 photo gnome3_alt_tab.png

Among the options on the right Turn on the option "Alternate Tab Extension"

 photo gnome3_alt_on.png

Now close the advanced settings and the Alt+tab should start working the traditional fashion now.

 photo gnome3_alt_traditional.png