* [Xenomai-help] Re: [Socketcan-users] send error: permission denied [not found] <DD39B5C3F4963040ADC9768BE7E430CBFFAD9F@is-hdq-exchange.marel.net> @ 2006-08-21 19:28 ` Wolfgang Grandegger 2006-08-21 19:47 ` Jan Kiszka 2006-08-21 19:52 ` [Xenomai-help] Re: [Socketcan-users] " Sebastian Smolorz 0 siblings, 2 replies; 6+ messages in thread From: Wolfgang Grandegger @ 2006-08-21 19:28 UTC (permalink / raw) To: Daniel Schnell; +Cc: xenomai-help, socketcan-users Hi Daniel, Daniel Schnell wrote: > Hi, > > > > I am new to socket can. > > > > I wanted to test the rtcan driver in combination with Linux and Xenomai > and made a little program according to the rtcansend program but with > some response time measurements. > > > > However after setting up the socket I get –EPERM when trying to send a > packet to the can device. As the documentation doesn’t state anything > about this error when calling rt_dev_send() I wonder why the error if at > all doesn’t appear earlier if I try to setup the socket. The test > program already ran nicely when I tested the peak can drivers for linux. > I just changed the driver specific calls. > > > > Attached you find the complete test file, the function task() is the one > to blame. > > > > I am a bit stuck with this, so maybe someone can give me a slight hint > in what i am doing wrong. I tried your program on my system and got the same error. The problem is, that rt_dev_send() is called from non-RT context, which is illegal. At a first glance, it's not obvious to me why. Therefore I added the Xenomai Help ML to the CCs. Wolfgang. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Re: [Socketcan-users] send error: permission denied 2006-08-21 19:28 ` [Xenomai-help] Re: [Socketcan-users] send error: permission denied Wolfgang Grandegger @ 2006-08-21 19:47 ` Jan Kiszka 2006-08-22 5:58 ` [Socketcan-users] [Xenomai-help] " Wolfgang Grandegger 2006-08-21 19:52 ` [Xenomai-help] Re: [Socketcan-users] " Sebastian Smolorz 1 sibling, 1 reply; 6+ messages in thread From: Jan Kiszka @ 2006-08-21 19:47 UTC (permalink / raw) To: Wolfgang Grandegger; +Cc: xenomai-help, socketcan-users, Daniel Schnell [-- Attachment #1: Type: text/plain, Size: 1724 bytes --] Wolfgang Grandegger wrote: > Hi Daniel, > > Daniel Schnell wrote: >> Hi, >> >> >> >> I am new to socket can. >> >> >> >> I wanted to test the rtcan driver in combination with Linux and >> Xenomai and made a little program according to the rtcansend program >> but with some response time measurements. >> >> >> >> However after setting up the socket I get –EPERM when trying to send a >> packet to the can device. As the documentation doesn’t state anything >> about this error when calling rt_dev_send() I wonder why the error if >> at all doesn’t appear earlier if I try to setup the socket. The test >> program already ran nicely when I tested the peak can drivers for >> linux. I just changed the driver specific calls. >> >> >> >> Attached you find the complete test file, the function task() is the >> one to blame. >> >> >> >> I am a bit stuck with this, so maybe someone can give me a slight hint >> in what i am doing wrong. > > I tried your program on my system and got the same error. The problem > is, that rt_dev_send() is called from non-RT context, which is illegal. ...but should not matter if the caller is a Xenomai thread in "Linux" mode. > At a first glance, it's not obvious to me why. Therefore I added the > Xenomai Help ML to the CCs. How did you all compile the program [1]? Using xeno-config --posix-cflags / --posix-ldflags? Jan PS: Daniel, if you go the POSIX way, you don't have to use rt_dev_, you can use the normal POSIX API directly. That services will be wrapped on the Xenomai core just like pthread&friends. [1]https://lists.berlios.de/pipermail/socketcan-users/attachments/20060821/ff454f48/cantest_rt.obj [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 250 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Socketcan-users] [Xenomai-help] Re: send error: permission denied 2006-08-21 19:47 ` Jan Kiszka @ 2006-08-22 5:58 ` Wolfgang Grandegger 2006-08-22 6:39 ` Jan Kiszka 0 siblings, 1 reply; 6+ messages in thread From: Wolfgang Grandegger @ 2006-08-22 5:58 UTC (permalink / raw) To: Jan Kiszka; +Cc: xenomai-help, socketcan-users, Daniel Schnell Jan Kiszka wrote: > Wolfgang Grandegger wrote: >> Hi Daniel, >> >> Daniel Schnell wrote: >>> Hi, >>> >>> >>> >>> I am new to socket can. >>> >>> >>> >>> I wanted to test the rtcan driver in combination with Linux and >>> Xenomai and made a little program according to the rtcansend program >>> but with some response time measurements. >>> >>> >>> >>> However after setting up the socket I get –EPERM when trying to send a >>> packet to the can device. As the documentation doesn’t state anything >>> about this error when calling rt_dev_send() I wonder why the error if >>> at all doesn’t appear earlier if I try to setup the socket. The test >>> program already ran nicely when I tested the peak can drivers for >>> linux. I just changed the driver specific calls. >>> >>> >>> >>> Attached you find the complete test file, the function task() is the >>> one to blame. >>> >>> >>> >>> I am a bit stuck with this, so maybe someone can give me a slight hint >>> in what i am doing wrong. >> I tried your program on my system and got the same error. The problem >> is, that rt_dev_send() is called from non-RT context, which is illegal. > > ...but should not matter if the caller is a Xenomai thread in "Linux" mode. > >> At a first glance, it's not obvious to me why. Therefore I added the >> Xenomai Help ML to the CCs. > > How did you all compile the program [1]? Using xeno-config > --posix-cflags / --posix-ldflags? No, ah, oh. It works using the above flags, indeed. I see, that it calls _rtdm_sendmsg in secondary execution mode (none-RT) first, which returned -ENOSYS (-38). Then I guess, the context is switch to primary mode and _rtdm_sendmsg is called again, correct? > Jan > > > PS: Daniel, if you go the POSIX way, you don't have to use rt_dev_, you > can use the normal POSIX API directly. That services will be wrapped on > the Xenomai core just like pthread&friends. Cool. I was not yet aware of that. > [1]https://lists.berlios.de/pipermail/socketcan-users/attachments/20060821/ff454f48/cantest_rt.obj Thanks for clarifying things. Wolfgang. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Socketcan-users] [Xenomai-help] Re: send error: permission denied 2006-08-22 5:58 ` [Socketcan-users] [Xenomai-help] " Wolfgang Grandegger @ 2006-08-22 6:39 ` Jan Kiszka 0 siblings, 0 replies; 6+ messages in thread From: Jan Kiszka @ 2006-08-22 6:39 UTC (permalink / raw) To: Wolfgang Grandegger; +Cc: xenomai-help, socketcan-users, Daniel Schnell [-- Attachment #1: Type: text/plain, Size: 2934 bytes --] Wolfgang Grandegger wrote: > Jan Kiszka wrote: >> Wolfgang Grandegger wrote: >>> Hi Daniel, >>> >>> Daniel Schnell wrote: >>>> Hi, >>>> >>>> >>>> >>>> I am new to socket can. >>>> >>>> >>>> >>>> I wanted to test the rtcan driver in combination with Linux and >>>> Xenomai and made a little program according to the rtcansend program >>>> but with some response time measurements. >>>> >>>> >>>> >>>> However after setting up the socket I get –EPERM when trying to send a >>>> packet to the can device. As the documentation doesn’t state anything >>>> about this error when calling rt_dev_send() I wonder why the error if >>>> at all doesn’t appear earlier if I try to setup the socket. The test >>>> program already ran nicely when I tested the peak can drivers for >>>> linux. I just changed the driver specific calls. >>>> >>>> >>>> >>>> Attached you find the complete test file, the function task() is the >>>> one to blame. >>>> >>>> >>>> >>>> I am a bit stuck with this, so maybe someone can give me a slight hint >>>> in what i am doing wrong. >>> I tried your program on my system and got the same error. The problem >>> is, that rt_dev_send() is called from non-RT context, which is illegal. >> >> ...but should not matter if the caller is a Xenomai thread in "Linux" >> mode. >> >>> At a first glance, it's not obvious to me why. Therefore I added the >>> Xenomai Help ML to the CCs. >> >> How did you all compile the program [1]? Using xeno-config >> --posix-cflags / --posix-ldflags? > > No, ah, oh. It works using the above flags, indeed. I see, that it calls > _rtdm_sendmsg in secondary execution mode (none-RT) first, which > returned -ENOSYS (-38). Then I guess, the context is switch to primary > mode and _rtdm_sendmsg is called again, correct? > Exactly, that's how it works. >> Jan >> >> >> PS: Daniel, if you go the POSIX way, you don't have to use rt_dev_, you >> can use the normal POSIX API directly. That services will be wrapped on >> the Xenomai core just like pthread&friends. > > Cool. I was not yet aware of that. Yes, and one should try to keep the sources clean (though mixing is technically fine): either go native and pick real-time related services from this API (would include task creation here) or go POSIX and use only that API. If unsure about the status of some particular function, see the docs or <xeno-installation>/lib/posix.wrappers for the list of available bindings. (*) > >> [1]https://lists.berlios.de/pipermail/socketcan-users/attachments/20060821/ff454f48/cantest_rt.obj >> > > Thanks for clarifying things. > > Wolfgang. > Jan (*) Native has the charm of being more explicit ("This is hard-RT, any other service not.") and sometimes more handy to use. POSIX is standard, thus far easier portable. And it may already be well known to the programmer. [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 250 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] Re: [Socketcan-users] send error: permission denied 2006-08-21 19:28 ` [Xenomai-help] Re: [Socketcan-users] send error: permission denied Wolfgang Grandegger 2006-08-21 19:47 ` Jan Kiszka @ 2006-08-21 19:52 ` Sebastian Smolorz 1 sibling, 0 replies; 6+ messages in thread From: Sebastian Smolorz @ 2006-08-21 19:52 UTC (permalink / raw) To: xenomai; +Cc: socketcan-users, Daniel Schnell Wolfgang Grandegger wrote: > Hi Daniel, > > Daniel Schnell wrote: > > Hi, > > > > > > > > I am new to socket can. > > > > > > > > I wanted to test the rtcan driver in combination with Linux and Xenomai > > and made a little program according to the rtcansend program but with > > some response time measurements. > > > > > > > > However after setting up the socket I get –EPERM when trying to send a > > packet to the can device. As the documentation doesn’t state anything > > about this error when calling rt_dev_send() I wonder why the error if at > > all doesn’t appear earlier if I try to setup the socket. The test > > program already ran nicely when I tested the peak can drivers for linux. > > I just changed the driver specific calls. > > > > > > > > Attached you find the complete test file, the function task() is the one > > to blame. > > > > > > > > I am a bit stuck with this, so maybe someone can give me a slight hint > > in what i am doing wrong. > > I tried your program on my system and got the same error. The problem > is, that rt_dev_send() is called from non-RT context, which is illegal. > At a first glance, it's not obvious to me why. Therefore I added the > Xenomai Help ML to the CCs. In short: Here we have a real time driver, and the send and receive routines are the time critical ones. They use synchronisation services of the underlying RTOS which must not be called from a normal Linux task (e.g. rtdm_sem_timeddown). If you really want to send or receive CAN messages from non-RT context - use the Socket-CAN patch available for normal NRT-Linux from which the RTDM CAN profile is derived from. Sebastian ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <DD39B5C3F4963040ADC9768BE7E430CBFFAEED@is-hdq-exchange.marel.net>]
* Re: [Socketcan-users] [Xenomai-help] Re: send error:permission denied [not found] <DD39B5C3F4963040ADC9768BE7E430CBFFAEED@is-hdq-exchange.marel.net> @ 2006-08-22 10:29 ` Jan Kiszka 0 siblings, 0 replies; 6+ messages in thread From: Jan Kiszka @ 2006-08-22 10:29 UTC (permalink / raw) To: Daniel Schnell; +Cc: xenomai-help, socketcan-users [-- Attachment #1: Type: text/plain, Size: 907 bytes --] Daniel Schnell wrote: > Hi, > > Thanks, this looks much better. Also thanks for pointing out the POSIX only solution. Althoug the final linkstage printout now has become _really_ longish. That has been shortened recently in Xenomai's SVN, will come with 2.3. > > I have made the call to rt_timer_read() because strangely the gettimeofday() call gave me more jitter than the xenomai native call. > Can this be confirmed by anybody ? So if I could replace this native call with a POSIX conforming call that works as good then I could get rid of -lnative from my makefile. > I could of course add a inline assembler readtsc call and calculate it myself with consideration of the actual cpu clock. But I thought that there is already something available. > Does anybody have any opinion about that ? > gettimeofday is not provided as real-time service, use clock_gettime instead. Jan [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 250 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-08-22 10:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <DD39B5C3F4963040ADC9768BE7E430CBFFAD9F@is-hdq-exchange.marel.net>
2006-08-21 19:28 ` [Xenomai-help] Re: [Socketcan-users] send error: permission denied Wolfgang Grandegger
2006-08-21 19:47 ` Jan Kiszka
2006-08-22 5:58 ` [Socketcan-users] [Xenomai-help] " Wolfgang Grandegger
2006-08-22 6:39 ` Jan Kiszka
2006-08-21 19:52 ` [Xenomai-help] Re: [Socketcan-users] " Sebastian Smolorz
[not found] <DD39B5C3F4963040ADC9768BE7E430CBFFAEED@is-hdq-exchange.marel.net>
2006-08-22 10:29 ` [Socketcan-users] [Xenomai-help] Re: send error:permission denied Jan Kiszka
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.