UDEV Rule to Create Links to USB Serial Converters

I have a few /dev/ttyUSB* and a few of those come from my Huawei modem, soem others are the USB-serial converters i work with. Since I do not always have everything connected the numbers change. Here is a UDEV rule to create symlinks for the USB-serial converters, PL2303 in this case:

ACTION=="add", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", KERNEL=="ttyUSB*", SYMLINK+="usbser%n"

Just create a file /etc/udev/rules.d/99-USB-serial.rules containing above line, then disconnect and reconnect the USB-serial converters. The result are the following links:

lrwxrwxrwx 1 root root 7 Aug 13 08:24 /dev/usbser0 -> ttyUSB0
lrwxrwxrwx 1 root root 7 Aug 13 08:24 /dev/usbser2 -> ttyUSB2

More information can be found here and here.

Magic Sea Additional Tuition School

Our children go to Lions School in Gadag. A while ago some people came to the school to make a test with the children and promised them some certificates. About two weeks ago we were invited us (parents and children) to the city to get that certificate.

We came into a waiting room where they asked a few questions about us and filled a form. After 5 minutes they led us to a room. There were 5 tables in the room and people sitting there, except on one table. Obviously they were other parents and their children. There was pretty loud music in the room to make sure that people can’t hear the conversation of the other tables. We were led to the free table and a women also sat to us. She asked a lot of questions and filled a form. While doing that one time suddenly the music was switched off. Then one men was standing up and saying something along the lines “Congratulations, we have a new student, they signed the contract”. A funny ritual.

Then she called a man to com to us and continue. Since I do not speak Kannada he wanted the permission to speak english from his boss. Sounds suspicious, no? His boss then personally came to us to continue.

He said that Magic Sea is present in over 75 cities in India teaching tens of thousands of students, that they do online education and how easy it is to learn by watching a movie, and that the government is paying halve of the fee so only 12’000 has to be paid by us for 6 month, but that offer is only “today”. I asked him more than once if he can show us one of these education movies he tried to sell us as “online education”. But he said that we have to come to the school when they are teaching because the teacher will teach all the things. Now what? Are the movies teaching the children or the teachers?

The whole thing was organized in a way to pressure parents and lure them into such a contract without ever showing them what exactly they get for the money. I started to believe that the whole thing is some kind of fraud. So my recommendation is stay away from Magic Sea!

My Experience with PIC

About 15 years ago a friend gave be a pile of PIC datasheets. I looked into them, read a few bits and decided PICs are not for me. Not much later another friend bought an AVR development kit and gave it to me to find out how it works. It wasn’t hard to get everything up and running. So I used AVRs since then, and if I need something bigger I take an STM32. But now I have a project which uses PIC18 and I was forced to bite the bullet. So here is my experience with the PIC hardware and software.

Continue reading

Paste not working the way it should?

Many (if not most) websites are broken in various ways these days. One of the favorite bugs of web developers is breaking copy&paste. For whatever reason pasting text into form fields is not working at all on many websites.

Today gvim was annoying me with a different misfeature: Pasting text with more than one line is always inserted on a new line above the cursor. I want the text pasted where the cursor is, not where vim’s developers think they would like it. That’s the last straw.

To solve this problem for all times I wrote a small script which converts the paste buffer into keystrokes. For all applications it will look as if that text has been entered with the keyboard. Here is the code of my pastinator.py. Download it and bind it to a key, for example Tux+V (Windows+V) or any other key you like.

Now always when I press Tux+V I get the contents of the copy buffer pasted exactly how I want it.

UDEV rule for USBASP

Again I got permission denied to access USBASP using avrdude. To fix this an UDEV rule has to be created.

A long time ago I created the file /etc/udev/rules.d/99-USB-AVR-PRG.rules with the following content:
# see: http://www.mikrocontroller.net/articles/AVRDUDE#Aufruf_unter_Linux_als_user_.28non-root.29
# http://hackaday.com/2009/09/18/how-to-write-udev-rules/
# udevadm info -a -p /sys/bus/usb/devices/3-1
# After a change restart udev:
# systemctl restart udev.service

# borked rule
# Atmel AVR ISP mkII
#SUBSYSTEM=="usb", SYSFS{idVendor}=="03eb", SYSFS{idProduct}=="2104", GROUP="users", MODE="0660"

# usbprog bootloader
#ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c62", GROUP="users", MODE="0660"

# USBasp programmer
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="05dc", GROUP="users", MODE="0666"

# USBtiny programmer
#ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c9f", GROUP="users", MODE="0660"

Most of the content is shamelessly copied and then commented out, then for me the only interesting line is the one for USBASP.

After copying the file I restarted UDEV with the following command:
systemctl restart udev.service

Now after plugging in USBASP the device should get the appropriate permissions.

How to Create a Verified E-Aadhaar Card PDF on Linux

The E-Aadhaar Card PDF which can be downloaded from the UID Authority of India contains a signature and some brain damaged verification code. In the middle of the page on the right side it shows “Not verified”, a yellow question mark and some more text about the digital signature. This question mark has to be clicked which then verification process. When this process is finished the question mark is replaced by a green tick and the text reads “Signature valid”. Since everybody just prints the page and deletes the file this verification process is completely superfluous. Since a smart ass wanted to save some money these documents are not signed by a proper key which makes the whole process a bit cumbersome.

The following steps show how to download the Aadhaar Card and convert it to a nice PDF:

Continue reading