Skip to contentSkip to conversation

linsocketcan

DISCUSSION Marc Kleine-Budde 1 participant 3 messages Nov 20, 2012 – Nov 21, 2012 3 messages not in the archive CAN network drivers

lore
Share & tools
lore

Marc Kleine-Budde

author maintainer
#1 lore raw
In reply to a message not in the archive

Hey Robert,

please use the linux-can mailinglist (Cc'ed). Don't post HTML mails there.

Quoted 9 lines · Robert

Hi,

I try use libsocketcan in my android application to work with CANbus
(ti_HECC ) in HMI device TH-1535 based on ARM3517 Sitara .

OS Android IceCream Linux kernel 2.6.37

Quoted 7 lines

Add libsocketcan.c to my jni folder and build library
libsocketcan.so use ndk-build (all ok no errors)

If use *can_set_bitrate**(“can0”, 125000),*function*send_mod_request return -1 (errno = 1, err->error = 2).*

If the libsocketcan isn't buggy here, and errno equals 1, you should have a look at the errno definition[1]. An errno of 1 means "Operation not permitted". In non Android Linux systems you need to be the root user to set the bitrate.

[1] http://lxr.free-electrons.com/source/include/asm-generic/errno-base.h#L4

Marc

Signature · 4 lines
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   |
author maintainer
#3 lore raw
In reply to a message not in the archive

Hello Robert,

please keep the mailinglist on Cc.

Quoted 2 lines · Robert

OS Android on my device is rooted.
I know the error codes and so I asked what may have caused the error No. 1.

A rooted devices doesn't mean that every process runs as root. Have you started your program as root?

Marc

Signature · 4 lines
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   |
author maintainer
#5 lore raw
In reply to a message not in the archive

Hello,

for the protocol, problem solved:

Quoted 4 lines · Robert
Quoted 2 lines

A rooted devices doesn't mean that every process runs as root. Have you started your program as root?

All ok, CANbus is Up. Thanks for suggestions.

\o/

Marc

Signature · 4 lines
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   |