Programming :: Python Serial And Struct On 64 Bit?

May 14, 2010

For a work project, I've got a bunch of python code from about a year ago that controls the movement of our EVI-D30 camera over a ttyUSB connection. It used to work fine on a 32-bit Fedora box, but recently we moved our whole project over to a 64-bit Gentoo server, and the same code seems to be worthless on the new platform. I didn't write the code, so I'm have trouble figuring out how to fix it. Error messages usually look like this:

Code:

File "./CameraController.py", line 172, in pan
turn_callback(cmdStruct[0], cmdStruct[1])
File "./CameraController.py", line 147, in turn_callback
cameras[camera].TiltUp()

[code]....

View 13 Replies


ADVERTISEMENT

Programming :: STL Container Into A C Struct

May 23, 2011

I have an old C application in which i am trying to include some STL cointainers. When i use the STL container alone it works fine, but when i include it into a C struct i have segmentation faults errors. I know that it is not a good idea to mix C and C++. Considering this code:

Code:

typedef struct{
int shmid;
...
APPLSPACETYPE applSpace;

[code]...

and how to make a malloc for this issue; something like :

Code:

mem->applSpace.rData.completeGroups2zeroGroup=(map_completeGroups2zeroGroup_type *)malloc((sizeof(map_completeGroups2zeroGroup_type)+1)* sizeof(char ));

View 11 Replies View Related

Programming :: Use A Class Inside A Struct?

Apr 8, 2011

Is is possible to use a class inside a struct? I keep getting segmentation fault with this code:

Code:

struct my_struct {
unsigned count;
std::string msg;

[code]....

View 3 Replies View Related

Programming :: Difference Between Struct And Union?

Nov 6, 2010

I have been spending time (starting yesterday) reverse-engineering GTK+ to get my programming skills up. I came across a struct in the headers (_GtkArg, which was then typedeffed into GtkArg) that includes a union in it that has pretty much the same properties as a struct. Then, there was a struct inside the union.

I'm confused. Just what is the difference between a union and a struct?

P.S. I am using GTK's native C programming language.

View 8 Replies View Related

Programming :: Memory Allocation For Struct In C++?

Mar 30, 2010

How do we allocate memory of struct? what i did was

Code:

int main()
struct amp
{

[code].....

cout <<"The size of 'struct' is"<< sizeof(struct amp)<<"and it is located at"<<struct amp*s = malloc(sizeof(struct amp))<<endl;
it gives me an error---
In funtion 'int main()':
error: expected primary-expression before 'struct'
error: expected ';' before 'struct'

View 9 Replies View Related

Programming :: Stl Vector As A Member Of A Struct?

Jan 17, 2011

is there any problem that might rise by by having a vector as a member of struct in c++ as follows.ex.

struct A
{
int a;

[code]...

View 2 Replies View Related

Programming :: Access Value From Nested Struct <c Language>?

Mar 11, 2010

I having a nested structures which are referenced with pointer variables :

example :
typedef struct {
int a ;
char *b ;
int *c ;
}EXP2 ;

[Code]...

While trying to access the value of sv.exp2->a it throws segmentation fault error.How to acess this variable ??

View 3 Replies View Related

Programming :: Sizeof Struct With Function Pointers As A Member?

Jul 2, 2010

I following structure
typedef struct
{

[code]...

View 5 Replies View Related

Programming :: Dereferencing Pointer To A Shared Memory Struct?

Feb 5, 2011

I have what should be a relatively simple program (fadec.c) that maps a struct from an included header file (fadec.h) to a shared memory region, but Im struggling accessing members in the struct from the pointer returned by shmat. Ultimately, I want to access members in the shared memory structure with a globally declared version of the struct, shm__. Not only do I not know how to accomplish that, but I cant even seem to access members of the shared struct directly from the pointer itself (compiler complains about dereferencing pointer to incomplete type). Im at a loss and could use another set of eyes if you guys dont mind taking a gander:

Compile Errors:
tony-pc:/cygdrive/p/test> cc -o fadec fadec.c
fadec.c: In function 'main':
fadec.c:30: error: dereferencing pointer to incomplete type
fadec.c:31: error: dereferencing pointer to incomplete type

[Code]...

View 1 Replies View Related

Programming :: Struct Timeval Doesn't Keep After Function Returns

Jun 2, 2010

int GetTime(struct timeval tv)
{
gettimeofday(&tv, NULL)
printf("%d
", tv.tv_sec); /* here is the right value */
return 0;
}

[Code]....

What happend? struct timeval has a self timer?

View 3 Replies View Related

Programming :: Create A Global Struct Variable With Predefined Member Values?

May 26, 2010

Is it possible to create a global struct variable with predefined member values?Only one instance of that struct is ever needed.

View 1 Replies View Related

Programming :: Differences Between Ncurses Library And Termios Struct W.r.t Keyboard Reading

May 3, 2010

I want to read a pressed key or a combination of pressed keys from the keyboard and perform some action afterwords.

e.g.

Ctrl-Alt-F1

Out of ncurses lib. and the termios struct which can be used best for the above purpose and why ?I tried to search on Google, the differences between these two but couldn't get much !

View 6 Replies View Related

Programming :: Make Python Programs Run Without Entering The Command Python?

Mar 22, 2009

I want to be able to do

sudo ./program.py

instead of always having to do

sudo python program.py

What do I need to change?

View 5 Replies View Related

Programming :: Python - Get Text File Data Into An Array On Python?

Nov 30, 2009

I've already used line split stuff to transform my data into something like this in a text file:

Code:

['1', '1', '3', '20.7505207']
['2', '1', '3', '23.0488319']
['3', '1', '3', '-1.5768747']
['4', '1', '3', '-26.4772491']

[code]....

How can I get this on a python program so I can manipulate it as an array?

View 3 Replies View Related

Programming :: Kernel API *get_super (struct Block_device *bdev) Producing Error With Fedora Core 5

Feb 2, 2011

I understand that block_device pointer *bd sholuld get initialized. Program should produce initialization error for *bd. Compiler is producing '->'. I am not understanding why?

[code]...

View 1 Replies View Related

Programming :: Kernel Module - Task_struct / Files Struct, Open_fds, And The Open File Descriptors In Task?

May 1, 2010

This for Kernel 2.6.29.6. I'm trying to code a kernel module that displays process information.

how to count opened file descriptors per task. I have been able to write a module that lists all the current process names along with their pid number in /var/log/messages. Basically, I cycle through the ring of processes using the macro for_each_process(task) and printk the comm and pid of each task. I'm trying to see how many file descriptors each task has open. I've been reading up in books and all over the internet. At first I thought I needed to access max_fds under files_struct, but that just lists the maximum number of file descriptors that can be opened per task, which by default is set at 256. I then thought about counting the elements in the fd_array. But then I learned that every task's fd_array is initially set at 32. Now I know that I need to access open_fds of type fd_set * in files_struct. open_fds is a pointer to all the open file descriptors. The problem is that I don't know how to access a pointer of type fd_set.

Is there a good guide or book that really focuses on type fd_set and open_fds? Every book and resource I've read never really go into depth on this. relationship between files struct, open_fds, and the open file descriptors in task?

View 4 Replies View Related

Programming :: Python 2.x - Represent The Same In Python 3.x

Mar 4, 2010

I have a function definition in a Python 2.x script which take a tuple as one of its arguments, but 2to3 has no answers nor any of my searching on how to represent the same in Python 3.x

Code:

def blah(self, (string1, string2))

View 4 Replies View Related

Programming :: Rs232 Serial Port Programming?

Jun 1, 2010

I have been working on writing a small rs232 driver like minicom for months. I am almost there, I have the interrupt service routine running, I can read() ok. However when I write(), it returns the number of characters written, 1, but nothing is actually written out the port. I researched termios, and they say that serial port programming is really messy in linux/unix.

I am probably not setting up the port parameters correctly, or my write() function is not doing what it is supposed to. As I said, write() is returning successful. Other comm programs run ok (picocom & gtkterm) on my hardware. I am running knoppix/debian on an ancient computer. I saw other guys using slackware.

View 14 Replies View Related

Programming :: Serial Port Programming String?

Nov 24, 2010

I have a serial port program which is reading a string .if(read(readfd,sResult,1)>0)where sResult is unsigned char sResult[10];if sResult is array of 10 then iam getting string perfectly but if iam making sResult only as unsigned char I am getting NULL value CODE BELOW

Code:
unsigned char sResult;
main()
{
readfd = open("/dev/ttyUSB0", O_RDONLY);
if (readfd == -1)
{
perror("READ: open_port: Unable to open /dev/ttyUSB0-

[Code]...

View 2 Replies View Related

Programming :: Totem Python Plugin Programming: Any Signal For Video Mouse Click?

Feb 9, 2011

I want that I click with the mouse on the video, it paused.I notice that there is "BaconVideoWidget" which I guess is the video rendering widget but it don't have signal named "clicked":

Code:
vd = totem_object.get_video_widget()
vd.connect("clicked", vd.hide)

[code]....

View 3 Replies View Related

Programming :: Get Serial EAGAIN Error

Apr 5, 2010

I use serial port. I get serial EAGAIN error. I open serial port with below settings.

do I have any error with settings.

static int fd=-1;
bool openPort(int baudrate, const char * ThePort) {
unsigned long BAUD;
struct termios port_settings;

[Code].....

View 3 Replies View Related

General :: Serial Port Programming Help

Apr 15, 2010

can we use inb() and outb() functions for serial port programming ??

View 5 Replies View Related

Programming :: C - Serial Port Won't Open?

Sep 1, 2010

I'm using C serial in a program to open and use a serial port but the port won't open for one reason or another. The program successfully runs on a different computer and when using RealTerm: Serial Capture Program, I can connect through the serial port with the same settings as I'm attempting through my c code. Anyone have any idea why it might be failing? I know this is still pretty vague, so let me know if there's other things I can tell you that might help to finding a solution

View 3 Replies View Related

Programming :: Switch Between Serial Protocols?

Jun 7, 2011

How to switch between serial protocols in c language? for example i need to switch between rs232 and rs422,(according to rs422 pinout)

View 2 Replies View Related

Debian Programming :: Serial Input In Scripts

Jun 10, 2013

I need a way to use serial input such as through an Arduino in Debian scripts, in any usable language.

View 2 Replies View Related

Programming :: Read X Bytes From Serial Port?

May 5, 2010

I am trying to write some code that interfaces with an AVR over a serial port. Basically I send a command then read the output which is 6 bytes. I need to receive all 6 bytes before the program continues. Is there a way to do this? If I use read() it returns -1 unless I add a delay before reading the port. Is there a way to get it to read the 6 bytes as soon as they arrive?In python you simply say how many bytes you want and the max time you are willing to wait which seems a whole lot easier than read

View 1 Replies View Related

Programming :: Intercept Data On Serial Port?

Dec 21, 2010

I dont know if this is the right forum, But I try to find a solution, I want to intercept data from/to serial port without disrupting the software that manages the serial port, (I would like to save the data to a file or sent into a socket) I searched somes modules and programs (linspy, ttysniff, interceptty, maxty ...), A bit complicated (There are some diff. between kernel 2.4 and 2.6), So I'd like to change the serial port driver to intercept the "read" and "write " and do what I want with the data, I'd like to know what do you think about

View 3 Replies View Related

Programming :: Serial Port Communications - CPU Bandwidth

Sep 15, 2010

I have an application written in C (by somebody else) monitoring a device connected to a serial port. I'm using an old laptop w. tinycore linux for an os. The app works well enough, and the communication speed is relatively slow, 9600bps, unidirectional, comes in packets of 18 bytes. The app is just picking apart the packets and displaying the contents on a formatted screen (ncurses), updating about once every 1/2 second. The trouble is, the app is polling the serial port and using *all* of the cpu bandwidth. The cpu fan runs full bore all the time.

Other activities are sluggish when the monitoring program is running. I'd like to modify the app to be a little more intelligent, use a receive buffer and interrupts to trigger processing each packet and, most importantly, not poll in a tight loop waiting for data. I'm not sure where to start, but I'm convinced this isn't that complicated of a change. Is there a good resource that would explain the basics of reading data from serial port software buffers, triggering on interrupts and suspending or sleeping when no interrupt is pending?

View 5 Replies View Related

Programming :: Send Data Through Serial Port Using C?

Oct 20, 2009

I am not a profession programmer. I have to write a C code which send some command to attach display using C program. Can any one please help me in this regard.

View 3 Replies View Related

Programming :: Multiple Protocols On Serial Port

Mar 24, 2011

I'm attempting to write an application that needs to read and reply to messages that will appear via 3 different methods:

1) Standard serial communications
2) TCPIP over serial via PPP
3) TCPIP over Ethernet

The problem is that I'd like for the application to be able to receive packets from any and all of the three interfaces simultaneously. I shouldnt have much trouble with performing #1 and #3 at the same time, as I think I can just get a file descriptor from termios and another for a socket and then use select to wait for data. But #2 is problematic.

First I dont know how to set up a socket that uses PPP as the data link layer. And secondly, (here's the big one) this PPP data is coming over the same port that the serial data is. There's no chance for data collision, and I am guaranteed not to receive another packet until I respond to the last one (in the same protocol at that) but incoming packets may or may not be PPP/TCP/IP framed.

My app will act like the PPP client, so I was just thinking "somehow" that I could run a standard termios application on the serial port which would begin to interpret the packet. If its PPP framed then it would have to get passed to a PPP client, which would be listening to my application rather than a physical port. And I have no idea how to do that. Is there an API available that will help me with the PPP packets?

How hard would it be to write a device driver that simulates a serial port. The device can listen on a real serial port, interpret its contents to an extent, and then distribute the incoming data to multiple "virtual" serial ports, which the main application can then listen to for incoming traffic.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved