WebCam, Python, Ubuntu?

•2012/01/11 • Comments Off

openCV:

http://opencv.willowgarage.com/wiki/#Welcome.2BAC8-Introduction.WhatisOpenCV.3F

lsusb:
Bus 003 Device 002: ID 093a:2621 Pixart Imaging, Inc. PAC731x Trust Webcam

http://www.jperla.com/blog/post/capturing-frames-from-a-webcam-on-linux

>>> camera = highgui.cvCreateCameraCapture(0)
HIGHGUI ERROR: V4L2: Pixel format of incoming image is unsupported by OpenCV
Unable to stop the stream.: Bad file descriptor
HIGHGUI ERROR: V4L: Pixel format of incoming image is unsupported by OpenCV

fixed with:
export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so
(

http://stackoverflow.com/questions/5033253/grabbing-images-from-a-webcam-to-be-used-with-opencv

http://www.linuxtv.org/downloads/v4l-dvb-apis/libv4l.html#id2858949

)

other:

http://digg.com/newsbar/topnews/HOWTO_Using_a_webcam_in_Python

OPC

•2012/01/02 • Comments Off

just some useless info:

OPC_SETLED 0x8C
OPC_CLRLED 0x8D
OPC_CLRFLASH 0x8E // solid
OPC_SETFLASH 0x8F

first (green) LED on NN=0001 on:

:S0000N8C00010000;
flash it:;
:S0000N8F00010000;

red:;
:S0000N8C00010001;

yellow:;
:S0000N8C00010002;

and OFF:
green:;
:S0000N8D00010000;
red:;
:S0000N8D00010001;
yellow:;
:S0000N8D00010002;

on and solid again:
green:;
:S0000N8C00010000;
:S0000N8E00010000;

TxCanBeep:
OPC_BEEP_CALL (sent when a call button is pressed)
9C CN CN PH PL CC

OPC_BEEP_CANCEL (sent when a cancel button is pressed)
9D CN CN PH PL CC

lights only:
OPC_BEEP_CALL (datalen = 5)
9C CN CN PH PL

OPC_BEEP_CANCEL (datalen = 5)
9D CN CN PH PL

messages intended for here:
OPC_SETONTIME
set:
E9 NN NN 00 TT
get:
E9 NN NN
// s0000ne94007;
// reply
// :SE470N7C400706;

OPC_DEEP_DEFVAL (logic hi or low)
set:
9B NN NN 00 DV
// :S0000N9b400800FD; // cancel button on caller 0 is normally closed
// :S0000N9b40070055; // cancel buttons on all callers are normally closed

get:
9B NN NN
// s0000n9b4008;
// reply:
// OK
// :SE320N7C4008FD;

OPC_BEEP_CONNECT
reply with all slot’s phone numbers, ack3 with i, PHi, PLi
9F NH NL (datalen = 3)
:S0000N9F4004;
{
:SE440N7C4004004004;
:SE440N7C4004028002;
:SE440N7C4004018003;
:SE440N7C4004038001;
}

set slot to phone number (datalen = 6):s0000n4004;
9F NH NL SS PH PL

the things we tell people using our software…

•2011/12/20 • Comments Off

So how are the two related? Hold on, I was installing Outlook?

Ever wanted to have a small keyboard with only 5 keys?

•2011/12/04 • Comments Off

The need is simple, a small/tiny keyboard that fits in your pocket to use in the lab or production floor to assist in running a test or installing something without having the space to put a full size keyboard. By the time you have the on screen keyboard up and working with a mouse or touch screen, you really don’t feel like doing the task any more. So a simple keyboard with just 5 keys, , , , es and o will do wonders!

I had a keyboard abused by the next generation with a few missing keys that I was about to throw in the dumpster, when I noticed that there are about 20 screws keeping the thing together, so of course, the curiosity got the upper hand! “What could be so important to be kept behind 20 screws?” Once opened, there was nothing waaau in the Logitech keyboard, but a tiny circuit board with 3 LEDs and the two connectors to the keyboard matrix. And a USB cable, of course.

Looking at the 2×1 inch board, I recalled my desire to build a tiny keyboard…so I tried it out. Soldered a momentary push button switch (NO) to the two tracks I traced from the ENTER button location, plugged it into the computer’s USB port and sure, I had a single () button key(board)!!!

How to use the input-utils package in Ubuntu:

http://smackerelofopinion.blogspot.com/2009/08/input-utils-package-are-bunch-of-tools.html

Finding you keyboard (or input device now)
~$ sudo lsinput will list all the input devices as /dev/input/eventX

And since the Logitech has X=2 here, from a sudo input-events 2 you’ll see the following by pressing and releasing the button:

~$ sudo input-events 2

/dev/input/event2
bustype : BUS_USB
vendor : 0x46d
product : 0xc315
version : 272
name : “Logitech Logitech USB Keyboard”
phys : “usb-0000:00:1a.7-3.2/input0″
uniq : “”
bits ev : EV_SYN EV_KEY EV_MSC EV_LED EV_REP

waiting for events
09:55:02.033247: EV_MSC code=4 value=458840
09:55:02.033252: EV_KEY KEY_KPENTER (0×60) pressed
09:55:02.033254: EV_SYN code=0 value=0

09:55:02.105242: EV_MSC code=4 value=458840
09:55:02.105246: EV_KEY KEY_KPENTER (0×60) released
09:55:02.105247: EV_SYN code=0 value=0

So let me get find and attach the , , and and then take some pictures!!!

•2011/08/12 • Comments Off

On a Dell Optiplex, it takes more than 5 minutes to shut Windows XP Pro down. Even pressing the power button results in almost no action for 60 seconds before the log out starts!

Latest Service Pack, ALL the Windows Updates to date
Things tried:

HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/WaitToKillServiceTimeout set to 200

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management was already set to 0

putting code into a Wiki with PHP!

•2011/08/11 • Comments Off

Need to get the inputs for the form from the URL, but without showing warnings when they are not specified:


global $wgOut;

$toDecode = '';
if ( !empty( $_GET )  ) {
  if ( isset($_GET['decode'] ) ) {
    $toDecode = $_GET['decode'];
  }
}

if ( empty($toDecode )  ) {
  $input = '8038'; # default value if none specified
} else {
  $input = $toDecode;
}

# end then the output...

$output .= '<textarea name="formula" cols="10" rows="1" wrap="off"/>';
$output .= $input;
$output .= '</textarea>

Shortcuts in Ubuntu? At least up to 10.10…

•2011/08/01 • Comments Off

Create your own with <Alt-F2>  gconf-editor in /apps/metacity/keybinding_commands and global_keybindings:  http://www.howtogeek.com/howto/ubuntu/assign-custom-shortcut-keys-on-ubuntu-linux/

Or use something that already exists in there: http://beginlinux.wordpress.com/2009/04/30/shortcuts-that-work-for-ubuntu-904/

 

(use lsb_release -a to get your Ubuntu version)

 

 

 

 

Window changed in Java?

•2011/05/30 • Comments Off

if (yes) {
if (!this.getTitle().endsWith(" *")) {
this.setTitle(this.getTitle() + " *");
}
} else {
this.setTitle(this.getTitle().replace(" *", ""));
}

JMRI 2.11.2 Error during loading /dev/ttyUSB0 not found while opening connection

•2011/02/18 • Comments Off

jmri fail when...???

The device is recognised:

anotheruser@dnpp:/dev$dmesg:

[ 2019.583226] ftdi_sio 6-2:1.0: FTDI USB Serial Device converter detected
[ 2019.583271] usb 6-2: Detected FT232RL


[ 2019.584338] usb 6-2: FTDI USB Serial Device converter now attached to ttyUSB0

And we are in the correct group and the device has ‘rw’ permissions to us:

anotheruser@dnpp:/dev$ ls /dev/ttyU* -al
crw-rw—- 1 root dialout 188, 0 2011-02-17 23:13 /dev/ttyUSB0

anotheruser@dnpp:/dev$ groups
anotheruser adm dialout cdrom plugdev lpadmin admin

But there is a lock file, and we don’t have rights to remove it (since the first user logged out):

anotheruser@dnpp:/var/lock$ ls -l
total 4
-r–r–r– 1 firstuser firstuser 11 2011-02-17 23:14 LCK..ttyUSB0

anotheruser@dnpp:/var/lock$ rm LCK..ttyUSB0
rm: remove write-protected regular file `LCK..ttyUSB0′? y
rm: cannot remove `LCK..ttyUSB0′: Operation not permitted

And neither does JMRI as shown in the JMRI System Console, except that the error message chases you down the no USB or no permission path for hours:

log4j:ERROR setFile(null,false) call failed.
java.io.FileNotFoundException: messages.log (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:209)

(but confusingly this is added)

688 gridconnect.GcSerialDriverAdapter   ERROR – Serial port /dev/ttyUSB0 not found [main]
690 configurexml.ErrorHandler   ERROR - /dev/ttyUSB0 not found while opening connection [main]

But from the command line, you can see more information interleaved between the log entries:

RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyUSB0
RXTX Error:  Unable to     remove stale lock file: /var/lock/LCK..ttyUSB0
RXTX Warning:  Removing stale lock file. /var/lock/LCK..ttyUSB0
RXTX Error:  Unable to     remove stale lock file: /var/lock/LCK..ttyUSB0

So maybe JMRI is not the source of the problem, but rather RxTx?!?

The bigger question is however, why does JMRI (or RxTx) leave a “stale lock file” every time it exits? If you run JMRI the very first time, you create the lock file, so when you run it again, you have permission to remove the lock file…unfortunately when someone else tries to run JMRI, they can’t delete your stale lock file!

network scanning…

•2011/02/01 • Comments Off

sudo apt-get install nmap

nmap -sP 192.168.0.1-255

 
Follow

Get every new post delivered to your Inbox.