* Bit rate configuration of PEAK USB devices
@ 2011-11-15 14:13 Heinz-Jürgen Oertel
2011-11-15 18:09 ` [Socketcan-users] " Oliver Hartkopp
0 siblings, 1 reply; 10+ messages in thread
From: Heinz-Jürgen Oertel @ 2011-11-15 14:13 UTC (permalink / raw)
To: socketcan-users@lists.berlios.de, linux-can@vger.kernel.org
Hello,
I tried
ip link set can0 type can bitrate 125000
and I tried socketcanlib
can_set_bitrate("can0", 125000);
but everytime got the error
RTNETLINK answers: Operation not permitted.
Reading the "PCAN driver for Linux - User Manual" v7.1
I could not find instructions to set the bit rate for netdev.
Who knows the best and/or correct way?
Regards
Heinz
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [Socketcan-users] Bit rate configuration of PEAK USB devices 2011-11-15 14:13 Bit rate configuration of PEAK USB devices Heinz-Jürgen Oertel @ 2011-11-15 18:09 ` Oliver Hartkopp 2011-11-15 18:33 ` Oliver Hartkopp 0 siblings, 1 reply; 10+ messages in thread From: Oliver Hartkopp @ 2011-11-15 18:09 UTC (permalink / raw) To: Heinz-Jürgen Oertel Cc: socketcan-users@lists.berlios.de, linux-can@vger.kernel.org Hello Heinz, On 15.11.2011 15:13, Heinz-Jürgen Oertel wrote: > I tried > ip link set can0 type can bitrate 125000 > and I tried socketcanlib > can_set_bitrate("can0", 125000); > but everytime got the error > RTNETLINK answers: Operation not permitted. > Reading the "PCAN driver for Linux - User Manual" v7.1 > I could not find instructions to set the bit rate for netdev. > > Who knows the best and/or correct way? Me :-) The netdev support inside the PEAK driver is a bit like an add-on to the original character device driver. Since PCAN Linux driver 6.0 you can compile the PEAK driver with netdev support which means that for each detected CAN device an 'additional' netdevice is being created. Unfortunately these netdevices only support the sending and receiving of CAN frames BUT no configuration of the CAN devices. This is still to be done via the chardev inodes in /dev/pcanXX .. See "PCAN driver for Linux - User Manual" v7.1, page 22 --- The 'ndev' column shows the network device assignment. For assignment of bitrates to network devices you can either set the desired bit rate as module load parameter or you can assign the bit rate after loading the driver with a simple command line invocation like: echo "i 0x4914 e" > /dev/pcan0 For this reason it is important to create the chardev-device-entries, too. If your target does no create the device files automatically with UDEV you have to run with the script ./pcan_make_devices 2 even if only the netdev driver is used. --- Indeed i was already thinking about the integration of the netlink-based configuration interface (of the mainline kernel) into the PCAN driver. But finally this would be another add-on ... IMHO the better approach would be to support the PEAK hardware in the form of mainline drivers, like we already have for the PCAN PCI and PCAN ISA hardware. A future PCAN USB driver could be created on the basis of the existing USB CAN adapter from ESD and EMS. Best regards, Oliver ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [Socketcan-users] Bit rate configuration of PEAK USB devices 2011-11-15 18:09 ` [Socketcan-users] " Oliver Hartkopp @ 2011-11-15 18:33 ` Oliver Hartkopp [not found] ` <4EC2B072.5060704-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org> 0 siblings, 1 reply; 10+ messages in thread From: Oliver Hartkopp @ 2011-11-15 18:33 UTC (permalink / raw) To: Heinz-Jürgen Oertel Cc: socketcan-users@lists.berlios.de, linux-can@vger.kernel.org I forgot to mention that you can also use the PCAN ioctl() interface on the PEAK chardevices or their pcanlib ... On 15.11.2011 19:09, Oliver Hartkopp wrote: > Hello Heinz, > > On 15.11.2011 15:13, Heinz-Jürgen Oertel wrote: > >> I tried >> ip link set can0 type can bitrate 125000 >> and I tried socketcanlib >> can_set_bitrate("can0", 125000); >> but everytime got the error >> RTNETLINK answers: Operation not permitted. >> Reading the "PCAN driver for Linux - User Manual" v7.1 >> I could not find instructions to set the bit rate for netdev. > >> > >> Who knows the best and/or correct way? > > > Me :-) > > The netdev support inside the PEAK driver is a bit like an add-on to the > original character device driver. > > Since PCAN Linux driver 6.0 you can compile the PEAK driver with netdev > support which means that for each detected CAN device an 'additional' > netdevice is being created. > > Unfortunately these netdevices only support the sending and receiving of CAN > frames BUT no configuration of the CAN devices. This is still to be done via > the chardev inodes in /dev/pcanXX .. > > See "PCAN driver for Linux - User Manual" v7.1, page 22 > > --- > > The 'ndev' column shows the network device assignment. For > assignment of bitrates to network devices you can either set the > desired bit rate as module load parameter or you can assign the bit > rate after loading the driver with a simple command line invocation > like: > > echo "i 0x4914 e" > /dev/pcan0 > > For this reason it is important to create the chardev-device-entries, > too. If your target does no create the device files automatically with > UDEV you have to run with the script > > ./pcan_make_devices 2 > > even if only the netdev driver is used. > > --- > > Indeed i was already thinking about the integration of the netlink-based > configuration interface (of the mainline kernel) into the PCAN driver. > > But finally this would be another add-on ... IMHO the better approach would be > to support the PEAK hardware in the form of mainline drivers, like we already > have for the PCAN PCI and PCAN ISA hardware. A future PCAN USB driver could be > created on the basis of the existing USB CAN adapter from ESD and EMS. > > Best regards, > Oliver > -- > To unsubscribe from this list: send the line "unsubscribe linux-can" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <4EC2B072.5060704-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>]
* Re: Bit rate configuration of PEAK USB devices [not found] ` <4EC2B072.5060704-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org> @ 2011-11-17 6:49 ` Heinz-Jürgen Oertel [not found] ` <B3B3BE5A55ED7743A83865E234A22B1D1B91F2BE57-E+xEQJb9ENTWDPv2tuTBK42P0GrZ+RbP@public.gmane.org> 0 siblings, 1 reply; 10+ messages in thread From: Heinz-Jürgen Oertel @ 2011-11-17 6:49 UTC (permalink / raw) To: Oliver Hartkopp Cc: socketcan-users-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org, linux-can-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On 15.11.2011 19:33, Oliver Hartkopp wrote: > I forgot to mention that you can also use the PCAN ioctl() interface on the > PEAK chardevices or their pcanlib ... > Danke Oliver, for now I decided to use something like system("echo \"i 0x4914 e\" > /dev/pcan0"); Unfortunately at the moment I have no idea how to determine if I'm just talking to an Peak or an EMS interface to select the method of setting the bit rate. Regards Heinz ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <B3B3BE5A55ED7743A83865E234A22B1D1B91F2BE57-E+xEQJb9ENTWDPv2tuTBK42P0GrZ+RbP@public.gmane.org>]
* Re: Bit rate configuration of PEAK USB devices [not found] ` <B3B3BE5A55ED7743A83865E234A22B1D1B91F2BE57-E+xEQJb9ENTWDPv2tuTBK42P0GrZ+RbP@public.gmane.org> @ 2011-11-17 11:24 ` Kurt Van Dijck [not found] ` <20111117112447.GA366-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org> 2011-11-17 16:11 ` Oliver Hartkopp 1 sibling, 1 reply; 10+ messages in thread From: Kurt Van Dijck @ 2011-11-17 11:24 UTC (permalink / raw) To: Heinz-Jürgen Oertel Cc: Oliver Hartkopp, socketcan-users-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org, linux-can-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Thu, Nov 17, 2011 at 07:49:43AM +0100, Heinz-Jürgen Oertel wrote: > > Danke Oliver, > > for now I decided to use something like > > system("echo \"i 0x4914 e\" > /dev/pcan0"); > > Unfortunately at the moment I have no idea how to determine if I'm just talking to an Peak or an EMS interface to select the method of setting the bit rate. Maybe $ ip -d link show can0 will show differently? Regards Kurt _______________________________________________ Socketcan-users mailing list Socketcan-users@lists.berlios.de https://lists.berlios.de/mailman/listinfo/socketcan-users ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <20111117112447.GA366-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org>]
* Re: Bit rate configuration of PEAK USB devices [not found] ` <20111117112447.GA366-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org> @ 2011-11-17 16:14 ` Oliver Hartkopp [not found] ` <4EC532E9.5050308-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org> 0 siblings, 1 reply; 10+ messages in thread From: Oliver Hartkopp @ 2011-11-17 16:14 UTC (permalink / raw) To: Kurt Van Dijck Cc: socketcan-users-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org, linux-can-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On 17.11.2011 12:24, Kurt Van Dijck wrote: > On Thu, Nov 17, 2011 at 07:49:43AM +0100, Heinz-Jürgen Oertel wrote: >> >> Danke Oliver, >> >> for now I decided to use something like >> >> system("echo \"i 0x4914 e\" > /dev/pcan0"); >> >> Unfortunately at the moment I have no idea how to determine if I'm just talking to an Peak or an EMS interface to select the method of setting the bit rate. > > Maybe > > $ ip -d link show can0 > > will show differently? No. The PEAK driver does not use the candev framework (drivers/net/can/dev.c). Therefore you won't see anything beyond up/down state and tx_queue_len, etc. Not bitrate settings :-( Regards, Oliver _______________________________________________ Socketcan-users mailing list Socketcan-users@lists.berlios.de https://lists.berlios.de/mailman/listinfo/socketcan-users ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <4EC532E9.5050308-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>]
* Re: Bit rate configuration of PEAK USB devices [not found] ` <4EC532E9.5050308-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org> @ 2011-11-17 16:25 ` Kurt Van Dijck [not found] ` <20111117162535.GF366-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org> 0 siblings, 1 reply; 10+ messages in thread From: Kurt Van Dijck @ 2011-11-17 16:25 UTC (permalink / raw) To: Oliver Hartkopp Cc: socketcan-users-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org, linux-can-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Thu, Nov 17, 2011 at 05:14:33PM +0100, Oliver Hartkopp wrote: > On 17.11.2011 12:24, Kurt Van Dijck wrote: > > > On Thu, Nov 17, 2011 at 07:49:43AM +0100, Heinz-Jürgen Oertel wrote: > >> > >> Danke Oliver, > >> > >> for now I decided to use something like > >> > >> system("echo \"i 0x4914 e\" > /dev/pcan0"); > >> > >> Unfortunately at the moment I have no idea how to determine if I'm just talking to an Peak or an EMS interface to select the method of setting the bit rate. > > > > Maybe > > > > $ ip -d link show can0 > > > > will show differently? > > > No. > > The PEAK driver does not use the candev framework (drivers/net/can/dev.c). > Therefore you won't see anything beyond up/down state and tx_queue_len, etc. > Not bitrate settings :-( My idea was to use this 'lack of information' to auto-decide if it's an EMS or PEAK interface. But Heinz-Jürgen already pointed out that using some /proc file, you can also see if a device is a PEAK device. Kurt > > Regards, > Oliver > -- > To unsubscribe from this list: send the line "unsubscribe linux-can" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html _______________________________________________ Socketcan-users mailing list Socketcan-users@lists.berlios.de https://lists.berlios.de/mailman/listinfo/socketcan-users ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <20111117162535.GF366-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org>]
* Re: Bit rate configuration of PEAK USB devices [not found] ` <20111117162535.GF366-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org> @ 2011-11-17 17:55 ` Wolfgang Grandegger [not found] ` <4EC54A78.2060109-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org> 0 siblings, 1 reply; 10+ messages in thread From: Wolfgang Grandegger @ 2011-11-17 17:55 UTC (permalink / raw) To: Oliver Hartkopp, socketcan-users-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org, linux-can-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On 11/17/2011 05:25 PM, Kurt Van Dijck wrote: > On Thu, Nov 17, 2011 at 05:14:33PM +0100, Oliver Hartkopp wrote: >> On 17.11.2011 12:24, Kurt Van Dijck wrote: >> >>> On Thu, Nov 17, 2011 at 07:49:43AM +0100, Heinz-Jürgen Oertel wrote: >>>> >>>> Danke Oliver, >>>> >>>> for now I decided to use something like >>>> >>>> system("echo \"i 0x4914 e\" > /dev/pcan0"); >>>> >>>> Unfortunately at the moment I have no idea how to determine if I'm just talking to an Peak or an EMS interface to select the method of setting the bit rate. >>> >>> Maybe >>> >>> $ ip -d link show can0 >>> >>> will show differently? >> >> >> No. >> >> The PEAK driver does not use the candev framework (drivers/net/can/dev.c). >> Therefore you won't see anything beyond up/down state and tx_queue_len, etc. >> Not bitrate settings :-( > My idea was to use this 'lack of information' to auto-decide if it's an EMS or PEAK > interface. But Heinz-Jürgen already pointed out that using some /proc file, you > can also see if a device is a PEAK device. The best solution would be to provide a *real* Socket-CAN driver for the PEAK USB devices instead of continuing with this mixed net-char-dev crap. Well, it does work basically but it's not what users nowadays want. Wolfgang. ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <4EC54A78.2060109-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>]
* Re: Bit rate configuration of PEAK USB devices [not found] ` <4EC54A78.2060109-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org> @ 2011-11-18 9:23 ` Marc Kleine-Budde 0 siblings, 0 replies; 10+ messages in thread From: Marc Kleine-Budde @ 2011-11-18 9:23 UTC (permalink / raw) To: Wolfgang Grandegger Cc: Oliver Hartkopp, socketcan-users-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org, linux-can-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [-- Attachment #1.1: Type: text/plain, Size: 612 bytes --] On 11/17/2011 06:55 PM, Wolfgang Grandegger wrote: > The best solution would be to provide a *real* Socket-CAN driver for the > PEAK USB devices instead of continuing with this mixed net-char-dev > crap. Well, it does work basically but it's not what users nowadays want. Full ACK. Can someone put people at peak on Cc? Marc -- Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | [-- Attachment #1.2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 262 bytes --] [-- Attachment #2: Type: text/plain, Size: 191 bytes --] _______________________________________________ Socketcan-users mailing list Socketcan-users-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org https://lists.berlios.de/mailman/listinfo/socketcan-users ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Bit rate configuration of PEAK USB devices [not found] ` <B3B3BE5A55ED7743A83865E234A22B1D1B91F2BE57-E+xEQJb9ENTWDPv2tuTBK42P0GrZ+RbP@public.gmane.org> 2011-11-17 11:24 ` Kurt Van Dijck @ 2011-11-17 16:11 ` Oliver Hartkopp 1 sibling, 0 replies; 10+ messages in thread From: Oliver Hartkopp @ 2011-11-17 16:11 UTC (permalink / raw) To: Heinz-Jürgen Oertel Cc: socketcan-users-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org, linux-can-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On 17.11.2011 07:49, Heinz-Jürgen Oertel wrote: > > On 15.11.2011 19:33, Oliver Hartkopp wrote: > >> I forgot to mention that you can also use the PCAN ioctl() interface on the >> PEAK chardevices or their pcanlib ... >> > > Danke Oliver, > > for now I decided to use something like > > system("echo \"i 0x4914 e\" > /dev/pcan0"); > > Unfortunately at the moment I have no idea how to determine if I'm just talking to an Peak or an EMS interface to select the method of setting the bit rate. An idea is to write different udev rules due to the different USB Vendor IDs, that do the initialization in different manners. If you want to set the default bitrate for all PEAK devices, you can set the global default bitrate on the module commandline. Regards, Oliver ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-11-18 9:23 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-15 14:13 Bit rate configuration of PEAK USB devices Heinz-Jürgen Oertel
2011-11-15 18:09 ` [Socketcan-users] " Oliver Hartkopp
2011-11-15 18:33 ` Oliver Hartkopp
[not found] ` <4EC2B072.5060704-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
2011-11-17 6:49 ` Heinz-Jürgen Oertel
[not found] ` <B3B3BE5A55ED7743A83865E234A22B1D1B91F2BE57-E+xEQJb9ENTWDPv2tuTBK42P0GrZ+RbP@public.gmane.org>
2011-11-17 11:24 ` Kurt Van Dijck
[not found] ` <20111117112447.GA366-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org>
2011-11-17 16:14 ` Oliver Hartkopp
[not found] ` <4EC532E9.5050308-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
2011-11-17 16:25 ` Kurt Van Dijck
[not found] ` <20111117162535.GF366-MxZ6Iy/zr/UdbCeoMzGj59i2O/JbrIOy@public.gmane.org>
2011-11-17 17:55 ` Wolfgang Grandegger
[not found] ` <4EC54A78.2060109-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
2011-11-18 9:23 ` Marc Kleine-Budde
2011-11-17 16:11 ` Oliver Hartkopp
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).