hello world
i’m trying to read from serial in virtual box ( from windows to linux) via file located in windows , so i wrote a simple code c in linux ( inb fucntion) to read from this file.txt , but i get not organized characters
for exemple i write in file.txt “abc” i get in linux “cab” or sometimes i get just 2 characters
anyone can help ? and thnx
On 2013-04-08 23:36, wiss1990 wrote:
> anyone can help ? and thnx
Insufficient data to compute an answer.
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
i just had problem in getting data with the function inb() , so i get not organized characters from serial as in file.txt (the file is browsed by the virtualbox in serial configuration)
On 2013-04-09 00:16, wiss1990 wrote:
>
> i just had problem in getting data with the function inb() , so i get
> not organized characters from serial as in file.txt (the file is browsed
> by the virtualbox in serial configuration)
I’ll try again:
What is the host?
What is the guest?
Where are those inb() calls?
What is running in the other one?
How To
Ask Questions The Smart Way
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
the host is windows 7 and the guest is open suse 11.2 , and i made a inb() at main function
On Mon, 08 Apr 2013 23:16:01 +0000, wiss1990 wrote:
> the host is windows 7 and the guest is open suse 11.2 , and i made a
> inb() at main function
Can you post some code snippets to show what exactly you’re doing?
That’s more helpful than providing a general description of what you’re
doing - code works because of precision, and troubleshooting code also
requires precision.
Jim
Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C
On 2013-04-09 01:16, wiss1990 wrote:
>
> the host is windows 7 and the guest is open suse 11.2 , and i made a
> inb() at main function
I quit.
I can not help if you refuse to give information.
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
so after the includes
i did that simple program
int main(){
int i=;
unsigned char c;
if(ioperm(“0x2F8”,“0x2F8”,1)<0) //0x2F8 is the adress of the com1 in virtualbox
{
perror("“0x2F8”);
return 1;
}
for(i=0;i<3;i++)
{
c=inb(“0x2F8”);
usleep(1000);
printf("%c",c);
}
return 0 ;
}
so the output is not organized letters as in file.txt
On Tue, 09 Apr 2013 08:26:02 +0000, wiss1990 wrote:
> so after the includes i did that simple program
The program you wrote shouldn’t even compile. Also, please use code tags
when posting code (or other input/output).
I see at least two syntax errors in your code that would prevent it from
compiling. Your declaration for ‘i’ is incomplete, and your perror
statement has three double quotes in it.
So let’s try code snippets that you’re using that compile. In code tags
(use the “#” button in the advanced post editor).
Don’t make us work so hard to get information from you about what you’re
trying to do - posting code that has obvious syntax errors in it and not
indicating which end of the conversation is which doesn’t make it easy
for us to help you.
Jim
–
Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C
Also, it occurs to me that you never did answer the question about why
you have to do this with serial communications - communicating between a
host and a guest using a serial connection seems an odd requirement. Why
not just use shared folders and a file accessed by the host and guest?
Jim
Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C
Seveal questions:
Why do you use an usleep after the inb instead of just using the
blocking read inb_p?
Why do you pass a character string to functions which expect integer
input parameters?
And please also answer the question from the others, it is absolutely
unclear what you really do and what runs on which environment.
Did you make sure that the settings for the serial port are the same on
the receiver and the sender side?
–
PC: oS 12.3 x86_64 | i7-2600@3.40GHz | 16GB | KDE 4.10.0 | GTX 650 Ti
ThinkPad E320: oS 12.3 x86_64 | i3@2.30GHz | 8GB | KDE 4.10.2 | HD 3000
HannsBook: oS 12.3 x86_64 | SU4100@1.3GHz | 2GB | KDE 4.10.0 | GMA4500
no it compiles just i didnt copy it properly maybe
my code needs an input from the windows (host)
i dont know i thought it’s clear , just the code didnt work properly
On Tue, 09 Apr 2013 18:16:02 +0000, wiss1990 wrote:
> no it compiles just i didnt copy it properly maybe
A copy/paste wouldn’t miscopy stuff like that. So I would assume you
typed it in by hand - try doing a copy/paste instead so we can see actual
working code. It’s hard enough to debug someone else’s code without it
being typed in properly for diagnosis.
> my code needs an input from the windows (host)
OK, still not really clear which code is being used where. Please
describe the setup in detail.
> i dont know i thought it’s clear , just the code didnt work properly
As I said, as written, it won’t work at all, so nobody’s going to be able
to help you get it working until you provide something that you’ve
actually compiled and tried to use.
Wanna try again?
Jim
Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C
On Tue, 09 Apr 2013 19:23:16 +0000, Jim Henderson wrote:
> Please describe the setup in detail.
And the goal, for that matter. All the posts you’ve made on this topic,
you still haven’t described what you are trying to accomplish with any
specificity.
Jim
Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C
if(ioperm(0x2F8,0x2F8,1)<0){
perror(“0x2F8”);
return 1;
}
//0x2F8
for(i=0;i<3;i++)
{
buf = inb(0x2F8);
printf("%c",buf);
}
this is the code
and i do that for taking data from host to guest to run it on char device
On Tue, 09 Apr 2013 22:16:02 +0000, wiss1990 wrote:
> if(ioperm(0x2F8,0x2F8,1)<0){
> perror(“0x2F8”);
> return 1;
> }
> //0x2F8 for(i=0;i<3;i++)
> {
> buf = inb(0x2F8); printf("%c",buf);
> }
> this is the code
Again…CODE TAGS!
I don’t know how many times we need to say it - when posting code, please
use code tags. When writing a post, go to the “Advanced editor” and
press the # button. Insert your code in between the tags. That will
help ensure that it’s readable.
The code looks fine to me as is. Without knowing why you’re doing this
(presumably the character device is connected to something - what is it
connected to? What is it’s purpose?)
> and i do that for taking data from host to guest to run it on char
> device
That still doesn’t explain the goal very clearly. You’re describing a
step, not what the overall setup is supposed to do or accomplish.
The chances are that there’s a far, far better way to do this than trying
to run it over a virtual serial port.
Without knowing your goal, it’s impossible to know if you’re approaching
it in a reasonable way or if there’s a better way to code what you’re
trying to code.
Again, providing us with information about what your goal is (not “I’m
trying to write to a character device” - that’s obvious, and a step, not
a goal) rather than making us play 20 questions to figure out what you’re
trying to do is making it difficult to help you. You’ve started three
separate threads on this topic over the past 2-3 weeks and still haven’t
said “I’m trying to do ‘x’”.
You’re not providing any specifics about your goal. All we know from 2-3
weeks of talking about this with you is that you want to use a virtualized
serial port to transfer data between a guest and a host. That’s
generally not the best way to move data between a guest and a host.
If you want help, you need to answer the questions put to you - we’re not
asking them because we don’t think they’re relevant - we’re asking them
because knowing the answers will help us help you come to a solution that
actually works.
As it stands, we’re 2-3 weeks into what is essentially “my thing’s
broke”, and that’s about all we’ve determined so far. I would really
like to help you, but you have to provide more than a one-sentence
description of what it is you’re trying to accomplish with this
particular step, and no information about what your overall objective is.
We can keep going around in circles with minimal information, or you can
answer the questions we’ve asked so we can make some progress. But the
longer it takes, the less interesting your problem becomes. When it’s
too much work to get necessary information from someone who wants help,
then the helpers tend to go find other things to help with - things where
they don’t have to beg for necessary information in order to help the
person asking the question.
Jim
Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C
On 04/08/2013 11:36 PM, wiss1990 wrote:
> anyone can help ?
please copy/paste the in/output from the two commands below, back to
this thread using the instructions here: http://goo.gl/i3wnr
uname -a
lsb_release -sircd
–
dd
if(ioperm(0x2F8,0x2F8,1)<0){
perror("0x2F8");
return 1;
}
//0x2F8
for(i=0;i<3;i++)
{
buf = inb(0x2F8);
printf("%c",buf);
}
sorry guys
seriously i dont know how to desribe more , my general setup is to make communication between host and guest via the serial ( it’s just a little project in mind) so i used “hote tube” in virtualbox config to make a file as an input in the serial , and in opensuse ( guest) i want to get the characters , as i said i got some characters but they are not organized as in file , so that’s my problem
and thnx guys
On Wed, 10 Apr 2013 14:46:03 +0000, wiss1990 wrote:
> seriously i dont know how to desribe more , my general setup is to make
> communication between host and guest via the serial ( it’s just a little
> project in mind)
What is the project in question? (That’s what I mean when I say “goal”)
And why serial? It would be easier to use a file in a shared folder to
pass information back and forth between the host and the guest. Or if
you’re using VMware, you might use the VMware SDK (as there are host-
guest communications channels set up that way as well).
Using a virtual serial interface is quite possibly the most difficult way
to do this.
Jim
Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C
> open suse 11.2
openSUSE 11.2 sailed past its end-of-life in May 2011 (cite:
http://en.opensuse.org/Lifetime)
so, suggest you update to supported software…and, maybe your
troubles recede in the rear view mirror.
–
dd