Page 3 of 3
Re: PCAN on Android
Posted: Mon 18. Aug 2014, 12:15
by mo_oin
hi,
i rebuilded and the 2 files are present. but when i make the module the previous error stays. so can i simply ignore the error and test the new module or what is to do now?
greez
ray
Re: PCAN on Android
Posted: Mon 18. Aug 2014, 16:07
by mo_oin
ok,
my boss was there and like always when the boss watches over u shoulder things start to work a bit better.

compiling succeeded and he pointed out that there seems to be issues with the mayor/ minor number.
we looked up in the drivers and it has issues in /driver/src/pcan_fops_linux.c
on function:
Code: Select all
static int pcan_open(struct inode *inode, struct file *filep)
here is the dmesg output after a failed bitrate set + proof module is with debug compiled:
Code: Select all
root@p880:/storage/sdcard0 # cat /proc/pcan
*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20140723_n (7.12.0) Aug 18 2014 14:14:09 --------------
*---------------------------- [dbg] [mod] [usb] -----------------------------
*--------------------- 1 interfaces @ major 241 found -----------------------
*n -type- ndev --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32 usb -NA- ffffffff 016 0x001c 00000000 00000000 00000000 00000000 0x0000
echo "i 0x14 0x00" > /dev/pcanusb0 <
/system/bin/sh: can't create /dev/pcanusb0: No such device
1|root@p880:/storage/sdcard0 # dmesg | grep pcan
<7>[14:08:18 14:27:05.002] pcan: pcan_open(), major/minor = 0/1.
<7>[14:08:18 14:27:05.002] pcan: pcan_search_dev(), major,minor = 0,1.
<7>[14:08:18 14:27:05.002] pcan: didn't find any pcan devices (0,1)
<7>[14:08:18 14:27:47.882] pcan: pcan_open(), major/minor = 0/1.
<7>[14:08:18 14:27:47.882] pcan: pcan_search_dev(), major,minor = 0,1.
<7>[14:08:18 14:27:47.882] pcan: didn't find any pcan devices (0,1)
<7>[14:08:18 14:31:28.072] pcan: pcan_open(), major/minor = 0/1.
<7>[14:08:18 14:31:28.072] pcan: pcan_search_dev(), major,minor = 0,1.
<7>[14:08:18 14:31:28.072] pcan: didn't find any pcan devices (0,1)
<7>[14:08:18 14:48:38.742] pcan: pcan_open(), major/minor = 0/1.
<7>[14:08:18 14:48:38.762] pcan: pcan_search_dev(), major,minor = 0,1.
<7>[14:08:18 14:48:38.762] pcan: didn't find any pcan devices (0,1)
<3>[14:08:18 14:49:52.262] pcan: read data stream turned off caused by err -32!
<7>[14:08:18 14:49:52.462] pcan: pcan_usb_plugout(): usb_if=cece0000
<7>[14:08:18 14:49:52.472] pcan: pcan_usb_plugout(32)
<7>[14:08:18 14:49:52.472] pcan: pcan_usb_cleanup(CAN#0)
<6>[14:08:18 14:49:52.472] pcan: pcan_del_device_from_list(cece0258)
<7>[14:08:18 14:49:52.472] pcan: pcan_delete_filter_chain(0xd05c89a0)
<7>[14:08:18 14:49:52.482] pcan: pcan_delete_filter_all(0xd05c89a0)
<7>[14:08:18 14:49:57.122] pcan: pcan_usb_plugin(0x0c72, 0x000c, 0x2e10)
<7>[14:08:18 14:49:57.132] pcan: pcan_usb_plugin(): bNumEndpoints=4
<6>[14:08:18 14:49:57.132] pcan: new usb adapter with 1 CAN controller(s) detected
<7>[14:08:18 14:49:57.132] pcan: pcan_usb_plugin(): EP[0]={addr=129 max=16}
<7>[14:08:18 14:49:57.132] pcan: pcan_usb_plugin(): EP[1]={addr=1 max=16}
<7>[14:08:18 14:49:57.132] pcan: pcan_usb_plugin(): EP[2]={addr=130 max=64}
<7>[14:08:18 14:49:57.132] pcan: pcan_usb_plugin(): EP[3]={addr=2 max=64}
<7>[14:08:18 14:49:57.132] pcan_usb_plugin(): ucHardcodedDevNr=0x10 ucRevision=0x2E
<7>[14:08:18 14:49:57.132] pcan: pcan_usb_allocate_resources()
<7>[14:08:18 14:49:57.132] pcan: pcan_usb_allocate_resources() allocate 256 bytes buffer for writing
<7>[14:08:18 14:49:57.132] pcan: pcan_usb_allocate_resources() allocate 2 buffers of 1024 bytes for reading
<7>[14:08:18 14:49:57.142] pcan: pcan_create_filter_chain()
<6>[14:08:18 14:49:57.142] pcan: usb hardware revision = 46
<6>[14:08:18 14:49:57.142] pcan: pcan_add_device_in_list(cece0258)
<7>[14:08:18 14:49:57.142] pcan: pcan_usb_setCANOff()
<7>[14:08:18 14:49:57.142] pcan: pcan_usb_setcontrol_urb(): ->EP#01
<7>[14:08:18 14:49:57.142] pcan: pcan_usb_param_xmit_notify() = 0
<6>[14:08:18 14:49:57.142] pcan: got 0 bytes URB, decoding it by packets of 64 bytes:
<7>[14:08:18 14:49:57.142] pcan: PCAN-USB fw 2.8 workaround
<7>[14:08:18 14:49:57.192] pcan: pcan_usb_setcontrol_urb(): ->EP#01
<7>[14:08:18 14:49:57.202] pcan: pcan_usb_param_xmit_notify() = 0
<7>[14:08:18 14:49:57.202] pcan: pcan_usb_getSNR()
<7>[14:08:18 14:49:57.202] pcan: pcan_usb_getcontrol_urb(): <-EP#81
<7>[14:08:18 14:49:57.202] pcan: pcan_set_function(6, 1)
<7>[14:08:18 14:49:57.202] pcan: pcan_usb_setcontrol_urb(): ->EP#01
<7>[14:08:18 14:49:57.202] pcan: pcan_usb_param_xmit_notify() = 0
<7>[14:08:18 14:49:57.202] pcan: pcan_usb_param_xmit_notify() = 0
<7>[14:08:18 14:49:57.202] pcan: SNR = 0xffffffff
<7>[14:08:18 14:49:57.202] pcan: pcan_usb_getDeviceNr()
<7>[14:08:18 14:49:57.202] pcan: pcan_usb_getcontrol_urb(): <-EP#81
<7>[14:08:18 14:49:57.202] pcan: pcan_set_function(4, 1)
<7>[14:08:18 14:49:57.202] pcan: pcan_usb_setcontrol_urb(): ->EP#01
<7>[14:08:18 14:49:57.202] pcan: pcan_usb_param_xmit_notify() = 0
<7>[14:08:18 14:49:57.202] pcan: pcan_usb_param_xmit_notify() = 0
<7>[14:08:18 14:49:57.202] pcan: DeviceNr = 0x10
<6>[14:08:18 14:49:57.202] pcan: usb device minor 32 found
<7>[14:08:18 14:50:54.952] pcan: pcan_open(), major/minor = 0/1.
<7>[14:08:18 14:50:54.962] pcan: pcan_search_dev(), major,minor = 0,1.
<7>[14:08:18 14:50:54.962] pcan: didn't find any pcan devices (0,1)
hope this helps
greetings,
ray
Re: PCAN on Android
Posted: Wed 20. Aug 2014, 10:08
by S.Grosjean
Hi,
Meanwhile I had look to the kernel .config you sent to me and it shows that it ISNOT configured for Udev... So, I don't understand how your Android system does manage to create the /dev/pcanusb0 device node...
So please, to be sure, on your LG phone, run these commands first:
Code: Select all
$ rmmod pcan
$ rm -f /dev/pcanusb*
Then give me the output file of this one:
Code: Select all
$ ls -l /dev/pcanusb* >& lspcanusb_nopcan.txt
If no file found, load the pcan driver with insmod, then give me again the output of:
Code: Select all
$ ls -l /dev/pcanusb* >& lspcanusb_pcan.txt
I know you gave it to me some days ago but we have to be sure to get the right information set (dmesg output shows major,minor = 0,1 while it should be 180,32, according to your previous /dev/pcanusb0 device node...):
Code: Select all
...
<6>[14:08:18 14:49:57.202] pcan: usb device minor 32 found
...
Please, also give me the output file of this command launched from you LG phone:
Code: Select all
$ cat /proc/devices >& catprocdev.txt
Finally, I'd like to get the ouput file of your dmesg command:
Regards,
Stéphane
Re: PCAN on Android
Posted: Wed 20. Aug 2014, 15:22
by mo_oin
Hi,
before i began i restarted my phone and as u expected the commands before insmod failed.
but after that everything went smooth. so i added the files.
and I did this after your instructions.
Code: Select all
root@p880:/ #
root@p880:/ # echo "i 0x14 0x00" /dev/pca*
// tried also (echo "i 0x14 0x00" /dev/pcanusb0) same output.
i 0x14 0x00 /dev/pcanusb0
root@p880:/ # cat /proc/pcan
*------------- PEAK-System CAN interfaces (www.peak-system.com) -------------
*------------- Release_20140723_n (7.12.0) Aug 18 2014 14:14:09 --------------
*---------------------------- [dbg] [mod] [usb] -----------------------------
*--------------------- 1 interfaces @ major 241 found -----------------------
*n -type- ndev --base-- irq --btr- --read-- --write- --irqs-- -errors- status
32 usb -NA- ffffffff 016 0x001c 00000000 00000000 00000000 00000000 0x0000
root@p880:/ # ls -la /dev/pcanusb0
crw------- root root 180, 32 2014-08-20 14:09 pcanusb0
then i did a
but it returned only a 1 for nothings there to grep. i expected a message like in my last post ... strange...
here one more step and the expected output ;/
Code: Select all
echo "m s 0x111 8 0 1 2 3 4 5 6 7" > /dev/pcanusb0
/system/bin/sh: can't create /dev/pcanusb0: No such device
1|root@p880:/ # dmesg |grep pcan
<7>[14:08:20 15:15:05.217] pcan: pcan_open(), major/minor = 0/1.
<7>[14:08:20 15:15:05.227] pcan: pcan_search_dev(), major,minor = 0,1.
<7>[14:08:20 15:15:05.227] pcan: didn't find any pcan devices (0,1)
root@p880:/ #
greetz
ray
Re: PCAN on Android
Posted: Wed 20. Aug 2014, 16:38
by S.Grosjean
Hi,
Your "lspcanusb_nopcan.txt" contains:
Code: Select all
crw------- root root 180, 32 2014-08-20 14:09 pcanusb0
while it should not, because I asked to "rm -f /dev/pcanusb*" just before (see my previous post please).
Be sure to remove the special /dev file please.
Otherwise, I can't explain this:
Code: Select all
<7>[14:08:20 15:15:05.217] pcan: pcan_open(), major/minor = 0/1.
if the command was:
For example, on any other Linux PC:
Code: Select all
$ ls -l /dev/pcanusb0
crw-rw-rw- 1 root root 180, 0 août 20 16:20 /dev/pcanusb0
$ echo "i 0x14" > /dev/pcanusb0
$ dmesg | grep pcan
...
[81140.722535] pcan: pcan_open(), major/minor = 180/0.
...
Your system configuration is somewhere wrong: opening a device node with major=180 minor=32 CAN'T lead to a pcan trace with major/minor = 0/1. pcan_open() displays these values directly read from the system i-node, using MINOR() and MAJOR() Kernel macros. Moreover, never seen a major == 0 !
IMHO, this looks like some wrong memory alignments somewhere or wrong header files used to compile pcan (not those used to build the Kernel). You should first be sure of that.
Regards,
Stéphane
Re: PCAN on Android
Posted: Thu 21. Aug 2014, 10:41
by mo_oin
hi,
So please, to be sure, on your LG phone, run these commands first:
CODE: SELECT ALL
$ rmmod pcan
$ rm -f /dev/pcanusb*
Then give me the output file of this one:
CODE: SELECT ALL
$ ls -l /dev/pcanusb* >& lspcanusb_nopcan.txt
If no file found, load the pcan driver with insmod, then give me again the output of:
CODE: SELECT ALL
$ ls -l /dev/pcanusb* >& lspcanusb_pcan.txt
i did the instructions in exact this order but since i restarted the handy the fist 2 commands throw simply the error file not found. i accidently used after the insmod the lspcanusb_nopcan instead of the lspcan_pcan (sorry).
nevertheless it doesnt change the fact that somehow it doesnt work with this kernel. or do u see a way to get this solved ?
greetz
ray
Re: PCAN on Android
Posted: Fri 14. Aug 2015, 13:38
by intence
Hey guys,
I´ve managed to get the kernel-module running on my Android-device (cross-compiled it on a linux-box), but to get my application running I need to link the library to it (libpcan.so). I´ve tried it on a linux-machine but ran into many problems (inclusion of header-files). My idea is to compile it directly on my Android-device but don´t know how to do this. Anyone out there who can give me some advice?
Many thanks in advance!
Jozef
Re: PCAN on Android
Posted: Mon 17. Aug 2015, 11:57
by PEAK-Support
Maybe this
Link could help?!
Re: PCAN on Android
Posted: Tue 21. Apr 2020, 16:08
by vpottierau
Hello,
This is 5 year old, I am wondering whether there has been more activities and development of PCAN drivers for Android?
I am interested in developing a smartphone app that would use a PEAK USB - CAN dongle. Is this still the main forum page to follow?
Thanks,
Vincent
Re: PCAN on Android
Posted: Tue 21. Apr 2020, 16:26
by M.Heidemann
Hello,
We did not futher pursue this matter and therefore no further documentation is available.
But:
There would be the possibility to use our PCAN-Wireless Gateway using Socket-communication instead and write an application for it, no driver would be needed in this case:
https://www.peak-system.com/PCAN-Wirel ... .html?&L=1
See chapter 1.3 of the developer documentation of these devices, it describes the communication via sockets and the structure of the trasnmitted IP-frame:
https://www.peak-system.com/produktcd/P ... on_eng.pdf
Is this a possible approach for you?
We also offer sample code for this implementation on request.
If you are interested, please send an email to info[at]peak-system.com
Best Regards
Marvin