|
So this "automation" passes the suspicious message to me ?
It is not OK to view on forum , but OK to "spam" me ?
Yet another half-baked software.
PS
I really want to know WHY you replied to my post?
Do you spend your time surfing every forum here?
Cheers
|
|
|
|
|
It seems that everything you don't understand is somehow taken as a personal assault. The spam filter is designed to prevent the site being flooded with rubbish (which often happens). As it is a piece of automated code, it errs on the side of caution, and sometimes flags innocent messages. Why is that half-baked?
|
|
|
|
|
It seems that everything you don't understand is somehow taken as a personal assault.
Nice example.
Have a nice day.
|
|
|
|
|
There are plenty of resources about ioctl.
All of them refer to "files" which is OK.
What is missing - as far as I am concerned - is actual code where commands and data passed via ioctl function are processed.
It is very common to read " use plain write " to do the hardware manipulation.
Since "what are you trying to do" is often first reply - here is a sample.
Purpose of the code is to output data to I2C hardware:
iResult = write(FileDescriptor,Data,iSize);
Works as expected.
When I get more familiar with ioctl I'll try use I2C ioctl "write macro" instead of "plain" write.
My primary question is - how to find the actual Linux code which "transfers" the write function to sending I2C clock and data. (Mrs Google - via Github - keeps giving me the "files" and not reference to actual Linux source code - perhaps I am asking wrong way - again. )
My secondary is - how to verify that my code actually reads I2C ACK when I send the I2C address.
All I am getting is "number of characters processed", which is fine, but does it "include " verifying the ACK?
Cheers
|
|
|
|
|
|
Yes, that is one of the doc I am using.
I do not see the device / driver dependency.
I thought the "ioctl" sort of bypasses the need for driver giving me access to kernel directly.
I am trying to send generic "write" i2c data.
I am under the impression that once the file descriptor is opened for "device " - in this case "dev/i2c-1" that is all I need to implement the ioctl.
I am not sure how to find the Linux source code for this.
|
|
|
|
|
Yes that is correct, sort of. The ioctl call allows you to send special messages to the device driver in order to control the device beyond normal read and write. For example the disk driver has ioctl messages that will return details of the physical settings of the disk. But these messages still go to the device driver, they do not bypass it. The actual details will vary from device to device, so you need the specific information related to the device you are accessing.
|
|
|
|
|
Yes, I know in case of I2C I need to know the actual data format to accomplish the task.
For now I like to verify that when I initialize the file descriptor with device and then call ioctl to tell the file descriptor to open commutation with I2C slave - by passing the actual I2C hardware address , - then I do not need to write the actual data "prefixed " with the address.
That is the part I am having trouble understanding - but I'll try to "write" with and without sending the I2C address.
I may post the code when I am done testing this.
Cheers
Vaclav
|
|
|
|
|
Found this one and it looks OK , but it seems that "open source" concept can be a challenge when it comes to Linux documentation.
Linux Man Pages[^]
No, I do not have specific question about an application.
PS
Is this forum recent addition to CodeProject?
Cheers
Vaclav
|
|
|
|
|
If you have a Linux system then you should use the man pages installed there. I have used Linux man pages[^] in the past, which seem quite comprehensive.
Yes, this is a recent addition to the forums.
|
|
|
|
|
I would like somebody to walk me thru this code to help me understand some details I am having an issue with.
The purpose of the code is to send 8 bits data to hardware – LCD - using SPI communication protocol and Linux ioctl, in C++.
It in an essence works, but I “do not get” totally how.
Since I am not interested in psychoanalysis of my code or “doing it differently” I would prefer to hold off my questions until somebody with interest and knowledge of all of the above – passing data to function , operation of ioctl “command” - SPI_IOC_MESSAGE and SPI (bidirectional ) communication replies.
Basic implementation of the code is a copy of C code and I like to clean it up so it looks as real C++.
function call
vna.spi.SPI_Transfer_3_Line(1);// send command - software reset
function SPI transfer
Reformatted
int C_IOCTL_SPI::SPI_Transfer_3_Line(char data) {
#ifdef DEBUG
cout << "*** TRACE file " << __FILE__ << endl;
cout << " function " << __FUNCTION__ << endl;
cout << " data " << +data << endl;
cout << " @ line \033[0m " << dec << __LINE__ << endl;
cout << "\033[0m " << endl;
#endif
struct spi_ioc_transfer xfer[2];
unsigned char buf[32], *bp;
unsigned char tx_buf[32], *tx_bp;
unsigned char rx_buf[32], *rx_bp;
int len, status;
if (FileDescriptor) {
#ifdef DEBUG
cout << "FileDescriptor OK " << dec << +FileDescriptor << endl;
#endif
}
memset(xfer, 0, sizeof xfer);
memset(buf, 0, sizeof buf);
memset(tx_buf, 0, sizeof tx_buf);
memset(rx_buf, 0, sizeof rx_buf);
len = sizeof buf;
buf[0] = data;
xfer[0].tx_buf = (unsigned long) buf;
xfer[0].rx_buf = (unsigned long) buf;
xfer[0].len = 1; for (int index = 0; index != xfer[0].len; index++)
cout << "TX buffer index " << dec << index << " 0x" << hex << +buf[index]<< endl;
for (int index = 0; index < 0x10; index++) {
if (buf[index])
cout
<< " ******************** commnad tx buffer value "
<< +buf[index] << endl;
}
xfer[1].rx_buf = (unsigned long) buf;
xfer[1].len = 16; status = ioctl(FileDescriptor, SPI_IOC_MESSAGE(2), xfer);
if (status < 0) {
cout << "status " << status << endl;
perror("Transfer error SPI_IOC_MESSAGE");
return -1;
}
printf("Expected reply of %d characters \n", len);
printf("Processed %d characters \n", status);
#ifdef DEBUG
cout << " TX DATA 0x" << hex << +data << endl;
cout << " TX DATA dec " << dec << +data << endl;
#endif
printf("response(%d): ", status);
for (int index = 0; index != xfer[1].len; index++) {
if (buf[index])
cout
<< " !!!!!!!!!!!!!!!!!!!!!! DATA response rx buffer value "
modified 27-Dec-18 12:43pm.
|
|
|
|
|
Vaclav_ wrote: This post (code) is NOT formatted due to copy from text editor It would not take much effort to format it correctly.
|
|
|
|
|
Hi Richard , I often wonder if you are actually reading my posts.
In case you missed it -here it is again
I am not interested in psychoanalysis of my code
And if this offends you - feeling is mutual.
I hope some day you will get / realize that I am looking for REAL help.
I know you are knowledgeable and can give a real help so stop this "I am your mother" posts.
Have a great 2019.
Cheers Vaclav
|
|
|
|
|
I did not psychoanalyse anything. I merely pointed out that presenting your question in a format that can be read easily by anyone offering help, is not difficult. The tools provided at the top of the edit box in these forums has everything you need. You ask for someone to take time out to work through a lot of unfamiliar code in order to explain it to your satisfaction. So, perhaps you could take time out to present your question in the standard (for this forum) format.
|
|
|
|
|
I need to know how to:
1) Change default keyboard layout
2) Add CD rom support
3) Find some documentation that tells me this!
Any help hugely appreciated,
|
|
|
|
|
Is our main thrust here C/C++ working with maybe QT? Or are we going in for BASH scripts.
...I just realized...this is going to be the Python forum, isn't it?
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Mono/WinForms rules on any platform
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Yeah, but we already generally have forums for that. There's gotta be something that makes it specifically "Linux Programming".
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
It's supposed to cover all languages/frameworks used for programming on Linux for Linux.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Thanks Chris, for enabling my insanity!
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Shouldn't it be called "Linux Development"?
Why is it programming when you do it on Linux, and development when you do it on Windows?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Because they are racist!
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
They are not races, but OS-es. AFAIK, there's no law against Ossisism
Still it bugs me, since it is inconsistent.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Eddy Vluggen wrote: there's no law against Ossisism Give it time.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Eddy Vluggen wrote: Why is it programming when you do it on Linux, and development when you do it on Windows?
Because we're all a bunch of cavement. It used to be called programming on Windows, too, but then MS wanted to improve our station in life. Noticed they didn't call it "engineering".
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|