Thursday, April 24, 2014

Opening cheap chinese USB charger

My USB charger has died so I ordered a new one. I chose a neat pink one :-)

While the seller claimed it to be a EU plug it turned out to be only compatible with the other part of the EU - it won't work with the ground pin of the CEE 7/5 socket.
I got a refund from the seller and kept the product. Since it's not usable anyway (apart from the cables) I looked inside.
First I pushed a thin screwdriver into the seam and pried gently
Then I was able to pull the insides out of the box
I guess there's no room for the ground pin there :-)
The PCB contains standard parts - Vishay MB6S bridge rectifier, Sharp PC817c optocoupler a power NPN 13003, a bunch of capacitors, diodes, resistors and a transformer.
I'm not desperate enough to repackage it to work with my sockets ... yet.

Wednesday, April 9, 2014

tail -f /dev/ttyUSB0 in Debian

After a recent Debian 7.4 (I hate the codenames!) update I was no longer able to read data from the Arduino's USB serial.
I found out that
cat /dev/ttyUSB0
worked, while
tail -f /dev/ttyUSB0
did nothing. Strangely enough, running the command in strace revealed that tail was reading the data correctly, it just failed to display them ...

I'm not sure whom to blame - coreutils or Debian. Anyway, here's the solution/workaround I found at debianforum.de:

$ stty -F /dev/ttyUSB0 0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
$ stty -F /dev/ttyUSB0 9600 raw hupcl min 0
$ tail ---disable-inotify -f /dev/ttyUSB0

Wednesday, April 2, 2014

fuck debian

"If the suspend / resume works well on your system, you are lucky"
https://wiki.debian.org/Suspend