Posts in Category: khm

USB Stick Cloning

dd if=/dev/sd? /dev/sd? bs=4M

? should be replaced by a character assigned by OS
The number for partition should be ignored.

The difference between ATMega 32U2 and 32U4

http://electronics.stackexchange.com/questions/20652/differences-between-atmega32u2-and-atmega32u4

oFSerial

The behavier of oFSerial and comport object on Pd is different.
oFSerial::available returns the number of bytes, and readByte returns byte itself only when the received message contains \n (ascii 13), which is highly problematic for high speed raw byte sending.

Presumably this is caused by the flags of serial fucntions.
in comport:
—–
new->c_cflag |= (CREAD | CLOCAL);

/* always nocanonical, this means raw i/o no terminal */
new->c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);

/* no post processing */
new->c_oflag &= ~OPOST;
——

in ofSerial

——
oflag O_RDWR | O_NOCITY | O_NONBLOCK
cflag CLOCAL | CREAD | CS8
cflag &= ~(PARENB | CSTOPB | CSIZE)

——

The problem is ofSerial does not canonical mode by
&= ~ICANON

so without sending \n or other special character, the front ends holds the data and not release them to the receiver app.

http://man7.org/linux/man-pages/man3/termios.3.html

Serial USB on Arch

When a serial USB device is inserted, the linux kernel detects it and put /dev/ttyACM0.
This is with rw-rw—- permission and this file belongs to uucp.
Thus, the user must include himself to the group uucp by

> sudo usermod -a -G uucp chikashi

relogin is required afterwards.

Electronic Components Distributors in Germany

http://digikey.com
– extremely high shipping cost (18 euro)
http://mouser.com
– extremely high shipping cost (20 euro)
http://www.arrow.com
– high shipping cost (11.95 euro)
http://www.ebv.com
– sales only large amount (more than 100)
http://de.futureelectronics.com
– sales only large amount (more than 100)
http://de.farnell.com
– very complicated procedure for getting a customer number

^ for toggling LED

How to use ^ operator
http://www.eskimo.com/~scs/cclass/int/sx4ab.html

The ^ (caret) operator performs a bitwise exclusive-OR on two integers. Each bit in the result is 1 if one, but not both, of the corresponding bits in the two input operands is 1. For example, 0x56 ^ 0x32 is 0x64:

0 ^ 0 = 0
0 ^ 1 = 1
1 ^ 0 = 1
1 ^ 1 = 0

Thus, PORTB ^= (1 << PB3) toggles the LED because if the LED is on(1) it returns 0, and it is off(0) it returns 1.

Auto login (Arch)

/etc/systemd/system/getty@tty1.service.d/autologin.conf
———————————-
[Service]
ExecStart=
ExecStart=-/usr/bin/agetty –autologin username –noclear %I 38400 linux
———————————-

to start lxde automatically

in .xinitrc
———————————-
exec startlxde
———————————-

to start application automatically after logging in;

~/.config/lxsession/LXDE/autostart
———————————-
@lxterminal  -e name of executable
———————————-

USB device and permission

The Peacock hardware is recognised as general human interface device and it is found under:

/dev/usb/hiddev0

> udevadm info -a /dev/usb/hiddev0

returns the info about the device: the most important info would be:

  • KERNEL==”hiddev0″
  • SUBSYSTEMS==”usb”
  • ATTRS{idVendor}==”03eb”
  • ATTRS{idProduct}==”204f”

You can test the rule by

> udevadm test /dev/usb/hiddev0

you will get errors if invalid commands are found in the rules

In order to open the permission of Peacock to all users

KERNEL==”hiddev[0-9]*”,SUBSYSTEM==”usbmisc”, SUBSYSTEMS=”usb”,ATTRS{idVendor}==”03eb”,  ATTRS{idProduct}==”204f”,MODE=”777″

Pattern for universal Xbee receiver

Pattern of 2 Xbee receiver

Pattern of 2 Xbee receiver

The left hand unit for Trombonist

This unit is designed for detecting the left hand movement (Wahwah effect with mute) of a trombone player.

Trombone

Trombone