IR Blaster for N1

Post Reply
User avatar
mad_ady
Posts: 5113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

IR Blaster for N1

Unread post by mad_ady » Wed Jul 11, 2018 10:17 pm

I'd like to add an IR blaster to my N1 (on the GPIO) and adapt the lirc_odroid module from xu4 (either from 4.9 branch or from 4.14) to work on N1's 4.4.

Since I haven't done kernel development nor hacking - my plan is to transplant the code over and look at how a GPIO is mapped to the driver. Most likely that will need adjustment. Any suggestions at what I should look for in addition to that?

I'll post feedback once I finish the hardware build (can't find my transistors at the moment) :D

joy
Posts: 611
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Contact:

Re: IR Blaster for N1

Unread post by joy » Wed Jul 25, 2018 5:05 pm

Hi mad_ady,

Based on the common approach from C2 and XU4, lirc_odroid module is needed to run IR blaster.
Here are the examples.
- XU4
https://github.com/hardkernel/linux/blo ... c_odroid.c
- C2
https://github.com/hardkernel/linux/blo ... c_odroid.c

I've tried to find another good approach like running application over userspace without modifying kernel side, but I haven't. :(

User avatar
mad_ady
Posts: 5113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: IR Blaster for N1

Unread post by mad_ady » Wed Jul 25, 2018 6:25 pm

Yes, that's what I had in mind. I'm not sure where you map GPIO to the module, but I will look into it.

joy
Posts: 611
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Contact:

Re: IR Blaster for N1

Unread post by joy » Wed Jul 25, 2018 6:34 pm

I think you can quickly catch the way when you look through the source code. :)

The common gpio functions like "gpio_request", "gpio_direction_output" and "gpio_set_value" are used
and using a module param, a specific gpio number is assigned.

User avatar
mad_ady
Posts: 5113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: IR Blaster for N1

Unread post by mad_ady » Wed Jul 25, 2018 6:43 pm

Thanks. I'll see when I can free up some time to look around :)

User avatar
mad_ady
Posts: 5113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: IR Blaster for N1

Unread post by mad_ady » Mon Dec 17, 2018 9:18 pm

Ok, as promissed 6 months ago, time came to look into this issue as well. I ported the changes from xu4's 4.14 to n1's 4.4 kernel and compiled the kernel + the lirc_odroid module. The module (by itself) loads fine into the kernel with this configuration:

Code: Select all

root@n1-pre:~# cat /etc/modprobe.d/lirc.conf 
options lirc_odroid gpio_out_pin=1033 softcarrier=1 invert=0
root@n1-pre:~# modprobe lirc_odroid
root@n1-pre:~# dmesg | tail -5
[   78.536644] rockchip-vop ff900000.vop: [drm:vop_crtc_enable] Update mode to 1680*1050, close all win
[  342.844355] lirc_dev: IR Remote Control driver registered, major 239 
[  342.849374] lirc_odroid: module is from the staging directory, the quality is unknown, you have been warned.
[  342.852422] lirc_odroid lirc_odroid.0: lirc_dev: driver lirc_odroid registered at minor = 0
[  342.852442] lirc_odroid: driver registered!
If I start lirc manually, everything is ok. But if I run irsend LIST, I get a null pointer in the kernel (good thing the kernel doesn't crash):

Code: Select all

[  529.573896] Unable to handle kernel NULL pointer dereference at virtual address 00000000 
[  529.582081] pgd = ffffffc0efe4b000                                                       
[  529.585667] [00000000] *pgd=0000000000000000, *pud=0000000000000000                      
[  529.592141] Internal error: Oops: 86000005 [#1] SMP                                      
[  529.597016] Modules linked in: lirc_odroid(C) lirc_dev rc_core squashfs nls_cp936 poly_hash_ce af_packet rock_gpiomem ip_tables x_tables
[  529.609486] CPU: 0 PID: 3428 Comm: lircd Tainted: G         C      4.4.114-ubuntu-03 #3
[  529.617488] Hardware name: Hardkernel ODROID-N1 (DT)
[  529.622458] task: ffffffc0efe19a00 task.stack: ffffffc0e2eb0000
[  529.628383] PC is at 0x0
[  529.630945] LR is at lirc_dev_fop_open+0x13c/0x210 [lirc_dev]
[  529.636689] pc : [<0000000000000000>] lr : [<ffffff8000c6debc>] pstate: 00000145
[  529.644084] sp : ffffffc0e2eb3b50
[  529.647399] x29: ffffffc0e2eb3b50 x28: 0000000000000000 
[  529.652746] x27: 0000000000000000 x26: ffffffc0f2027000 
[  529.658092] x25: ffffff8000c70000 x24: ffffffc0efd0cc80 
[  529.663438] x23: ffffffc0e25dd500 x22: ffffffc0e9c2d270 
[  529.668785] x21: ffffff8000c70040 x20: 0000000000000000 
[  529.674131] x19: ffffffc0e2509e00 x18: 0000007fe4edcf94 
[  529.679478] x17: 0000007f8280b618 x16: ffffff80081b1b44 
[  529.684823] x15: 000000000000000a x14: 0000000000000000 
[  529.690169] x13: 0000000000000000 x12: 0000000000000020 
[  529.695515] x11: 0000007fe4edd058 x10: 0000000000000000 
[  529.700861] x9 : 0000000000000000 x8 : ffffffc0efd0cdb0 
[  529.706207] x7 : 0000000000000000 x6 : 000000000000003f 
[  529.711553] x5 : ffffff8000c7a470 x4 : 0000000000000000 
[  529.716899] x3 : 0000000000000003 x2 : ffffff800923ea40 
[  529.722245] x1 : 0000000000000000 x0 : 0000000000000000 
[  529.727593] 
               LR: 0xffffff8000c6de3c:
[  529.732563] de3c  f9403a60 b50002a0 f9407677 f94022e0 95d2aa53 72001c1f 54000281 910782a0
[  529.740906] de5c  79404401 361000e1 58000922 2a1403e5 b9402a64 aa1303e3 f9404261 95e5b1bf
[  529.749247] de7c  aa1903e0 95fd21b9 aa1803e1 aa1603e0 95d507e5 17ffffcd 97ffc551 34fffd60
[  529.757588] de9c  2a0003f4 17ffffee b9409660 f9403261 11000400 b9009660 f9402260 d63f0020
[  529.765930] debc  2a0003f4 34000140 f94022e0 95d2aa75 b9409660 51000400 b9009660 f9407a60
[  529.774271] dedc  b4fffbe0 95d1668b 17ffffdd f9406e77 b94052e0 34000120 9100a2fa aa1a03e0
[  529.782612] defc  95fd279b f90026ff aa0003e1 aa1a03e0 95fd27e4 17fffff2 58000360 58000301
[  529.790954] df1c  91050021 95d3d6f0 d4210000 17ffffec 12800254 17ffffd3 12803ff4 17ffffa3
[  529.799297] 
               SP: 0xffffffc0e2eb3ad0:
[  529.804266] 3ad0  e9c2d270 ffffffc0 e25dd500 ffffffc0 efd0cc80 ffffffc0 00c70000 ffffff80
[  529.812608] 3af0  f2027000 ffffffc0 00000000 00000000 00000000 00000000 e2eb3b50 ffffffc0
[  529.820949] 3b10  00c6debc ffffff80 e2eb3b50 ffffffc0 00000000 00000000 00000145 00000000
[  529.829291] 3b30  e2509e00 ffffffc0 00000000 00000000 00000000 00000080 081b6c98 ffffff80
[  529.837631] 3b50  e2eb3ba0 ffffffc0 081b6d9c ffffff80 00000000 00000000 e25dd500 ffffffc0
[  529.845973] 3b70  00c79128 ffffff80 e9c2d270 ffffffc0 09131000 ffffff80 efd0cc80 ffffffc0
[  529.854314] 3b90  0000011d 00000000 f2027000 ffffffc0 e2eb3bf0 ffffffc0 081b0778 ffffff80
[  529.862655] 3bb0  efd0cc80 ffffffc0 e9c2d270 ffffffc0 00000000 00000000 081b6c40 ffffff80
[  529.871000] 
               X2: 0xffffff800923e9c0:
[  529.875970] e9c0  00000000 00000000 08f63315 ffffff80 00000000 00000000 00000000 00000000
[  529.884311] e9e0  00000000 00000000 00000000 00000000 08f6332a ffffff80 00000000 00000000
[  529.892652] ea00  00000000 00000000 00000000 00000000 00000000 00000000 08f63338 ffffff80
[  529.900993] ea20  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  529.909334] ea40  08f633a8 ffffff80 00000000 00000000 00000000 00000000 00000000 00000000
[  529.917676] ea60  00000000 00000000 08f6339d ffffff80 00000000 00000000 00000000 00000000
[  529.926017] ea80  00000000 00000000 00000000 00000000 08f633b3 ffffff80 00000000 00000000
[  529.934358] eaa0  00000000 00000000 00000000 00000000 00000000 00000000 08f633bf ffffff80
[  529.942703] 
               X5: 0xffffff8000c7a3f0:                                                                                                                                                               [115/1126]
[  529.947673] a3f0  efe9d740 ffffffc0 00000000 00000000 00000000 00000000 00000000 00000000
[  529.956014] a410  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  529.964355] a430  00000000 00000000 00000000 00000005 00c79488 ffffff80 00c7a448 ffffff80
[  529.972696] a450  00c7a448 ffffff80 efe9d790 ffffffc0 efe9d790 ffffffc0 00c785c8 ffffff80
[  529.981038] a470  00000004 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  529.989379] a490  de3c9c00 ffffffc0 00000000 dead4ead ffffffff 00000000 ffffffff ffffffff
[  529.997721] a4b0  00c7a4b0 ffffff80 00c7a4b0 ffffff80 00000000 dead4ead ffffffff 00000000
[  530.006062] a4d0  ffffffff ffffffff 00000004 00000100 00000000 00000000 000003ff 00000001
[  530.014407] 
               X8: 0xffffffc0efd0cd30:
[  530.019376] cd30  ffffffff ffffffff 00000000 00000000 00000000 00000000 00000000 00000000
[  530.027717] cd50  eee12180 ffffffc0 00000000 00000000 00000000 00000000 00000000 00000000
[  530.036059] cd70  00000000 00000000 00000000 00000000 00000000 00000000 efd0cd88 ffffffc0
[  530.044400] cd90  efd0cd88 ffffffc0 efd0cd98 ffffffc0 efd0cd98 ffffffc0 e9c2d3e8 ffffffc0
[  530.052741] cdb0  00000000 00000000 00000000 00000000 de41ea00 ffffffc0 081b3e90 ffffff80
[  530.061083] cdd0  00000000 00000000 00000000 00000000 00000000 00000000 08be5d80 ffffff80
[  530.069424] cdf0  00000000 dead4ead ffffffff 00000000 ffffffff ffffffff 00000000 00000000
[  530.077765] ce10  00020000 0002801d 00000001 00000000 00000000 dead4ead ffffffff 00000000
[  530.086114] 
               X16: 0xffffff80081b1ac4:
[  530.091168] 1ac4  aa1803e0 2a1603e2 9400f208 aa1803e2 52800005 d2800004 52800023 2a1603e1
[  530.099509] 1ae4  aa1703e0 9400f0d3 aa1403e1 2a1503e0 94006ede 17ffffe6 a9bd7bfd 910003fd
[  530.107850] 1b04  a90153f3 f90013f5 aa0103f4 aa0203f5 aa0003f3 aa1e03e0 d503201f 2a1503e3
[  530.116191] 1b24  320f0282 aa1303e1 12800c60 97ffff7c f94013f5 a94153f3 a8c37bfd d65f03c0
[  530.124532] 1b44  a9bd7bfd 910003fd a90153f3 a9025bf5 aa0003f3 aa0103f4 aa1e03e0 aa0203f5
[  530.132873] 1b64  aa0303f6 d503201f 2a1603e3 320f02a2 aa1403e1 2a1303e0 97ffff69 a94153f3
[  530.141214] 1b84  a9425bf5 a8c37bfd d65f03c0 a9be7bfd 910003fd a90153f3 aa0103f4 aa0003f3
[  530.149555] 1ba4  aa1e03e0 d503201f 2a1403e2 52804821 aa1303e0 97ffffd1 a94153f3 a8c27bfd
[  530.157900] 
               X19: 0xffffffc0e2509d80:
[  530.162955] 9d80  e2656a50 ffffffc0 00000000 00000000 00000000 00000000 f8a19dc0 0000007f
[  530.171296] 9da0  00000003 00000000 de4997c0 ffffffc0 00000000 00000000 00000000 00000000
[  530.179637] 9dc0  00000004 0000002e de7e701c ffffffc0 de7e701c ffffffc0 00000000 00000000
[  530.187978] 9de0  00000000 00000000 f8a1afef 0000007f 00000000 00000000 00000000 00000000
[  530.196319] 9e00  6372696c 72646f5f 0064696f 00000000 00000000 00000000 00000000 00000000
[  530.204660] 9e20  00000000 00000000 00000000 00000001 00000000 00000000 00000302 00000000
[  530.213002] 9e40  00000000 00000000 00000000 00000000 00000000 00000000 00c7a498 ffffff80
[  530.221343] 9e60  00000000 00000000 00000000 00000000 00000000 00000000 00c79128 ffffff80
[  530.229687] 
               X21: 0xffffff8000c6ffc0:
[  530.234742] ffc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  530.243083] ffe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  530.251424] 0000  00000000 00000000 00000000 dead4ead ffffffff 00000000 ffffffff ffffffff
[  530.259766] 0020  00c70020 ffffff80 00c70020 ffffff80 efe19a00 ffffffc0 00000000 00000000
[  530.268107] 0040  00c6f775 ffffff80 00c6f178 ffffff80 00c6fb3d ffffff80 00c6f35a ffffff80
[  530.276449] 0060  00000227 00000000 00c6f775 ffffff80 00c6f178 ffffff80 00c6fb3d ffffff80
[  530.284790] 0080  00c6f37a ffffff80 00000237 00000000 00c6f775 ffffff80 00c6f18a ffffff80
[  530.293132] 00a0  00c6fb3d ffffff80 00c6f3c0 ffffff80 00000249 00000000 00c6f775 ffffff80
[  530.301475] 
               X22: 0xffffffc0e9c2d1f0:
[  530.306529] d1f0  00000000 00000000 e9c2f900 ffffffc0 00000000 dead4ead ffffffff 00000000
[  530.314871] d210  ffffffff ffffffff 00000001 00000000 00200000 00000000 00000000 00000000
[  530.323212] d230  00000000 00000000 e9c2d238 ffffffc0 e9c2d238 ffffffc0 e9c2d248 ffffffc0
[  530.331554] d250  e9c2d248 ffffffc0 00010001 dead4ead ffffffff 00000000 ffffffff ffffffff
[  530.339895] d270  000521b0 00000000 0000002c 00000000 00000000 00000000 00000000 00000000
[  530.348236] d290  08bd8280 ffffff80 f1b08000 ffffffc0 e9c2d3e8 ffffffc0 00006675 00000000
[  530.356576] d2b0  00000001 0ef00000 00000000 00000000 5c179166 00000000 33d7ebe3 00000000
[  530.364918] d2d0  5c179166 00000000 33d7ebe3 00000000 5c179166 00000000 33d7ebe3 00000000
[  530.373260]                                                                                                                                                                                        [56/1126]
               X23: 0xffffffc0e25dd480:
[  530.378315] d480  00c7d000 ffffff80 00c81000 ffffff80 00000001 00000000 003dd619 ffffffc0
[  530.386656] d4a0  00206318 ffffffc0 e25dd718 ffffffc0 00206330 ffffffc0 e25dd730 ffffffc0
[  530.394997] d4c0  ef0b58a0 ffffffc0 f05080d8 ffffffc0 00000000 00000000 000011c0 00000000
[  530.403338] d4e0  00000040 00000000 0001e548 00000000 00000000 00380040 00400007 0019001a
[  530.411679] d500  e9c7c200 ffffffc0 e25dd508 ffffffc0 e25dd508 ffffffc0 00000000 00000000
[  530.420020] d520  00000000 00000000 091318a8 ffffff80 00000000 00000000 00000002 00000001
[  530.428361] d540  00c7a180 ffffff80 00c79128 ffffff80 e9c2d4c0 ffffffc0 e9c2d4c0 ffffffc0
[  530.436703] d560  0ef00000 00000001 00000000 00000000 00000000 00000000 00000000 00000000
[  530.445046] 
               X24: 0xffffffc0efd0cc00:
[  530.450100] cc00  00000000 00000000 00000000 00000000 f1a7b6c0 ffffffc0 00000000 00000000
[  530.458441] cc20  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  530.466782] cc40  de964b00 ffffffc0 efd0cc48 ffffffc0 efd0cc48 ffffffc0 efd0cc58 ffffffc0
[  530.475123] cc60  efd0cc58 ffffffc0 de964ca8 ffffffc0 00000000 00000000 00000000 00000000
[  530.483465] cc80  00000000 00000000 00000000 00000000 f1af7360 ffffffc0 df1b80d8 ffffffc0
[  530.491805] cca0  e9c2d270 ffffffc0 00c79128 ffffff80 00000000 dead4ead ffffffff 00000000
[  530.500146] ccc0  ffffffff ffffffff 00000001 00000000 00020002 0000001f 00000001 00000000
[  530.508487] cce0  00000000 dead4ead ffffffff 00000000 ffffffff ffffffff efd0ccf8 ffffffc0
[  530.516830] 
               X25: 0xffffff8000c6ff80:
[  530.521884] ff80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  530.530225] ffa0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  530.538567] ffc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  530.546908] ffe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  530.555248] 0000  00000000 00000000 00000000 dead4ead ffffffff 00000000 ffffffff ffffffff
[  530.563589] 0020  00c70020 ffffff80 00c70020 ffffff80 efe19a00 ffffffc0 00000000 00000000
[  530.571931] 0040  00c6f775 ffffff80 00c6f178 ffffff80 00c6fb3d ffffff80 00c6f35a ffffff80
[  530.580273] 0060  00000227 00000000 00c6f775 ffffff80 00c6f178 ffffff80 00c6fb3d ffffff80
[  530.588617] 
               X26: 0xffffffc0f2026f80:
[  530.593671] 6f80  c3df8240 ffffffbd 003008dc 00000000 00001000 00000000 f7e09000 ffffffc0
[  530.602012] 6fa0  eeb443c0 ffffffc0 081e222c ffffff80 00000000 00000000 f2026fb8 ffffffc0
[  530.610353] 6fc0  f2026fb8 ffffffc0 00000000 00000000 00000000 00000000 00000000 00000000
[  530.618694] 6fe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[  530.627035] 7000  00200000 00000002 00000000 00000000 00000000 00000000 f2027000 ffffffc0
[  530.635376] 7020  00000000 00000001 f2027038 ffffffc0 f1b10070 ffffffc0 0000002f 00000000
[  530.643717] 7040  00000000 00000000 00000000 00000000 00000000 00000000 2b8c2b8c dead4ead
[  530.652058] 7060  ffffffff 00000000 ffffffff ffffffff 000000bb 00000000 00000000 00000000
[  530.660403] 
               X29: 0xffffffc0e2eb3ad0:
[  530.665458] 3ad0  e9c2d270 ffffffc0 e25dd500 ffffffc0 efd0cc80 ffffffc0 00c70000 ffffff80
[  530.673799] 3af0  f2027000 ffffffc0 00000000 00000000 00000000 00000000 e2eb3b50 ffffffc0
[  530.682140] 3b10  00c6debc ffffff80 e2eb3b50 ffffffc0 00000000 00000000 00000145 00000000
[  530.690481] 3b30  e2509e00 ffffffc0 00000000 00000000 00000000 00000080 081b6c98 ffffff80
[  530.698822] 3b50  e2eb3ba0 ffffffc0 081b6d9c ffffff80 00000000 00000000 e25dd500 ffffffc0
[  530.707164] 3b70  00c79128 ffffff80 e9c2d270 ffffffc0 09131000 ffffff80 efd0cc80 ffffffc0
[  530.715505] 3b90  0000011d 00000000 f2027000 ffffffc0 e2eb3bf0 ffffffc0 081b0778 ffffff80
[  530.723847] 3bb0  efd0cc80 ffffffc0 e9c2d270 ffffffc0 00000000 00000000 081b6c40 ffffff80


[  530.733683] Process lircd (pid: 3428, stack limit = 0xffffffc0e2eb0000)
[  530.740297] Stack: (0xffffffc0e2eb3b50 to 0xffffffc0e2eb4000)
[  530.746043] 3b40:                                   ffffffc0e2eb3ba0 ffffff80081b6d9c
[  530.753869] 3b60: 0000000000000000 ffffffc0e25dd500 ffffff8000c79128 ffffffc0e9c2d270
[  530.761695] 3b80: ffffff8009131000 ffffffc0efd0cc80 000000000000011d ffffffc0f2027000
[  530.769521] 3ba0: ffffffc0e2eb3bf0 ffffff80081b0778 ffffffc0efd0cc80 ffffffc0e9c2d270
[  530.777347] 3bc0: 0000000000000000 ffffff80081b6c40 ffffffc0e2eb3e7c ffffffc0efd0cc90
[  530.785172] 3be0: 0000000000000000 0000000000000000 ffffffc0e2eb3c30 ffffff80081b16d0
[  530.792998] 3c00: ffffffc0efd0cc80 ffffffc0e2eb3d60 0000000000000000 0000000000000000
[  530.800824] 3c20: ffffffc0e2eb3e7c 0000000000020002 ffffffc0e2eb3c50 ffffff80081bfac4
[  530.808649] 3c40: ffffffc0e2eb3d60 ffffffc0efd0cc80 ffffffc0e2eb3d20 ffffff80081c116c
[  530.816474] 3c60: ffffffc0e2eb3e7c 0000000000000001 00000000ffffff9c ffffffc0de1f6000
[  530.824300] 3c80: 0000000080000000 0000000000000015 000000000000011d 0000000000000038
[  530.832125] 3ca0: ffffff8008bc2000 ffffffc0efe19a00 0000000000000000 0000000000000001
[  530.839950] 3cc0: 0000000000000000 0000000000000000 0000000500000041 0000000000000026
[  530.847776] 3ce0: 0000000000000000 ffffffc0debbaaf8 0000000400000000 ffffffc0e9c2d270
[  530.855601] 3d00: 0000000000000000 0000000000000000 ffffffc0f1af7360 ffffffc0df1b80d8
[  530.863427] 3d20: ffffffc0e2eb3e30 ffffff80081b1a78 ffffffc0de1f6000 00000000ffffff9c
[  530.871253] 3d40: 0000000000000008 0000007f82774d98 ffffffc0e2eb3dc0 ffffff80081cd460
[  530.879078] 3d60: ffffffc0f1af7360 ffffffc0df1b80d8 00000005b0dfcf71 ffffffc0de1f6021
[  530.886904] 3d80: 0000000000000000 ffffffc0debbaaf8 ffffffc0e9c2d270 0000000400000101
[  530.894729] 3da0: 0000000000000f0a 0000000000000000 ffffffc0e2eb3db8 ffffff80081cd444
[  530.902555] 3dc0: ffffffc0e2eb3e10 ffffff80081cd5a8 0000000000020002 00000000ffffff9c
[  530.910380] 3de0: 0000000000020002 0000007f82774d98 0000000080000000 0000000000000015
[  530.918206] 3e00: 000000000000011d 0000000000000038 ffffffc0e2eb3e30 ffffffc0de1f6000
[  530.926031] 3e20: 0000000000000000 ffffff9c00000002 ffffffc0e2eb3e90 ffffff80081b1b80
[  530.933857] 3e40: ffffffffffffff9c 0000007f82774d98 0000000000000002 0000000000000000
[  530.941683] 3e60: 0000000080000000 0000000000000015 0ef000000000002c 0002000200000000
[  530.949508] 3e80: 000000265c170000 0000000100000100 0000000000000000 ffffff8008082f30
[  530.957334] 3ea0: 0000000000000000 00000040eee09000 ffffffffffffffff 0000007f8280b678
[  530.965159] 3ec0: ffffffffffffff9c 0000007f82774d98 0000000000000002 0000000000000000
[  530.972984] 3ee0: 0000000000000007 0000000000000000 0000000000001fb0 000000000000000a
[  530.980809] 3f00: 0000000000000038 0000007f824a16d0 0000000000000000 0000007fe4edd058
[  530.988635] 3f20: 0000000000000020 0000000000000000 0000000000000000 000000000000000a
[  530.996461] 3f40: 0000007f82842ee0 0000007f8280b618 0000007fe4edcf94 0000007f82820000
[  531.004286] 3f60: 0000007f82774d98 0000007f82775d40 0000005564d7d040 0000000000000000
[  531.012112] 3f80: 0000000000000000 0000000000000000 0000007fe4edd5f8 0000005564d7c000
[  531.019938] 3fa0: 0000005564d7d040 0000007fe4edd370 0000007f82830d68 0000007fe4edd370
[  531.027764] 3fc0: 0000007f8280b678 0000000080000000 ffffffffffffff9c 0000000000000038
[  531.035589] 3fe0: 0000000000000000 0000000000000000 0000000800000014 00000000ffffffff
[  531.043409] Call trace:
[  531.045859] Exception stack(0xffffffc0e2eb3980 to 0xffffffc0e2eb3ab0)
[  531.052306] 3980: ffffffc0e2509e00 0000008000000000 ffffffc0e2eb3b50 0000000000000000
[  531.060132] 39a0: 0000000000000001 0000000000000004 ffffffc0e2eb3a10 ffffff80080c797c
[  531.067957] 39c0: ffffffc0e2eb39e0 ffffff80081a62d8 ffffffc0de65bc00 00000000024004c0
[  531.075783] 39e0: ffffffc0e2eb3a30 ffffff80089fac68 ffffffc0de65bc00 00000000024004c0
[  531.083609] 3a00: ffffff80089fad44 ffffffc0e2eb3abf 00000000000001c0 0000000000000000
[  531.091434] 3a20: 0000000000000000 0000000000000000 ffffff800923ea40 0000000000000003
[  531.099259] 3a40: 0000000000000000 ffffff8000c7a470 000000000000003f 0000000000000000
[  531.107085] 3a60: ffffffc0efd0cdb0 0000000000000000 0000000000000000 0000007fe4edd058
[  531.114909] 3a80: 0000000000000020 0000000000000000 0000000000000000 000000000000000a
[  531.122732] 3aa0: ffffff80081b1b44 0000007f8280b618
[  531.127605] [<          (null)>]           (null)
[  531.132320] [<ffffff80081b6d9c>] chrdev_open+0x15c/0x168
[  531.137636] [<ffffff80081b0778>] do_dentry_open.isra.0+0x264/0x2b8
[  531.143818] [<ffffff80081b16d0>] vfs_open+0x70/0x74
[  531.148699] [<ffffff80081bfac4>] path_openat+0x724/0xb9c
[  531.154011] [<ffffff80081c116c>] do_filp_open+0x48/0x94
[  531.159238] [<ffffff80081b1a78>] do_sys_open+0x158/0x1dc
[  531.164550] [<ffffff80081b1b80>] SyS_openat+0x3c/0x4c
[  531.169610] [<ffffff8008082f30>] el0_svc_naked+0x24/0x28
[  531.174922] Code: bad PC value
[  531.178265] ---[ end trace c8adeabd46d02c33 ]---
Strace for the irsend command doesn't list /dev/lirc0, but spends some time at the last write call, which results in broken pipe:

Code: Select all

...
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9d17d000
mprotect(0x7f9d0e4000, 16384, PROT_READ) = 0
mprotect(0x7f9cdc5000, 4096, PROT_READ) = 0
mprotect(0x7f9cde9000, 4096, PROT_READ) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9d17b000
mprotect(0x7f9cf71000, 40960, PROT_READ) = 0
mprotect(0x7f9cf93000, 4096, PROT_READ) = 0
mprotect(0x7f9d106000, 4096, PROT_READ) = 0
mprotect(0x7f9d136000, 4096, PROT_READ) = 0
mprotect(0x557edb3000, 4096, PROT_READ) = 0
mprotect(0x7f9d185000, 4096, PROT_READ) = 0
munmap(0x7f9d13b000, 122173)            = 0
brk(NULL)                               = 0x5584700000
brk(0x5584721000)                       = 0x5584721000
socket(AF_UNIX, SOCK_STREAM, 0)         = 3
connect(3, {sa_family=AF_UNIX, sun_path="/var/run/lirc/lircd"}, 110) = 0
openat(AT_FDCWD, "/etc/localtime", O_RDONLY|O_CLOEXEC) = 4
fstat(4, {st_mode=S_IFREG|0644, st_size=2221, ...}) = 0
fstat(4, {st_mode=S_IFREG|0644, st_size=2221, ...}) = 0
read(4, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\0\0\10\0\0\0\0"..., 4096) = 2221
lseek(4, -1406, SEEK_CUR)               = 815
read(4, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\10\0\0\0\10\0\0\0\0"..., 4096) = 1406
close(4)                                = 0
socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 4
connect(4, {sa_family=AF_UNIX, sun_path="/dev/log"}, 110) = 0
sendto(4, "<15>Dec 17 14:15:23 irsend: lirc"..., 75, MSG_NOSIGNAL, NULL, 0) = 75
write(3, "LIST lgirplus.conf \n", 20)   = -1 EPIPE (Broken pipe)
--- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=1762, si_uid=0} ---
+++ killed by SIGPIPE +++
I remember something similar happened when migrating from kernel 4.9 to 4.14 and required some changes from you. I'll try to see what's changed and try with the 4.9 module code instead...

User avatar
mad_ady
Posts: 5113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: IR Blaster for N1

Unread post by mad_ady » Wed Dec 19, 2018 12:13 am

Ok, I tried it with the lirc_odroid code from 4.9 and this time it doesn't cause the problem when doing irsend LIST:

Code: Select all

root@n1-pre:~# irsend LIST lgirplus.conf ""

0000000000000001 power-off
0000000000000002 power-on-hot-30
0000000000000003 power-on
0000000000000004 on-16
0000000000000005 on-17
0000000000000006 on-18
0000000000000007 on-19
0000000000000008 on-20
[  146.093929] lirc_dev: IR Remote Control driver registered, major 239
[  146.096203] lirc_odroid: module is from the staging directory, the quality is unknown, you have been warned.
[  146.098794] lirc_odroid lirc_odroid.0: lirc_dev: driver lirc_odroid registered at minor = 0
[  146.098810] lirc_odroid: driver registered!



[  176.454098] lirc_odroid is opened
[  176.576614] lirc_odroid is closed
[  184.944093] lirc_odroid is opened
[  184.947723] lirc_odroid is closed

The difference is small. Probably these functions were needed in older kernels and not needed in 4.14 and newer:

Code: Select all

root@n1-pre:~/development/linux# git diff
diff --git a/drivers/staging/media/lirc/lirc_odroid.c b/drivers/staging/media/lirc/lirc_odroid.c
index b90a1d80132e..29c6dd0a61b5 100644
--- a/drivers/staging/media/lirc/lirc_odroid.c
+++ b/drivers/staging/media/lirc/lirc_odroid.c
@@ -194,6 +194,18 @@ exit_init_port:
        return ret;
 }
 
+/* called when the character device is opened */
+static int set_use_inc(void *data)
+{
+       pr_info(LIRC_DRIVER_NAME " is opened\n");
+       return 0;
+}
+
+static void set_use_dec(void *data)
+{
+       pr_info(LIRC_DRIVER_NAME " is closed\n");
+}
+
 /*
  * Header space pulse
  * + pre_data space pulse pairs
@@ -298,8 +310,12 @@ static struct lirc_driver driver = {
        .name           = LIRC_DRIVER_NAME,
        .minor          = -1,
        .code_length    = 1,
+       .sample_rate    = 0,
        .data           = NULL,
+       .add_to_buf     = NULL,
        .rbuf           = &rbuf,
+       .set_use_inc    = set_use_inc,
+       .set_use_dec    = set_use_dec,
        .fops           = &lirc_fops,
        .dev            = NULL,
        .owner          = THIS_MODULE,
I will test to see if it actually sends pulses and works in the following days.

joy
Posts: 611
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Contact:

Re: IR Blaster for N1

Unread post by joy » Fri Dec 21, 2018 2:14 pm

mad_ady wrote:
Wed Dec 19, 2018 12:13 am
The difference is small. Probably these functions were needed in older kernels and not needed in 4.14 and newer:

Code: Select all

root@n1-pre:~/development/linux# git diff
diff --git a/drivers/staging/media/lirc/lirc_odroid.c b/drivers/staging/media/lirc/lirc_odroid.c
index b90a1d80132e..29c6dd0a61b5 100644
--- a/drivers/staging/media/lirc/lirc_odroid.c
+++ b/drivers/staging/media/lirc/lirc_odroid.c
@@ -194,6 +194,18 @@ exit_init_port:
        return ret;
 }
 
+/* called when the character device is opened */
+static int set_use_inc(void *data)
+{
+       pr_info(LIRC_DRIVER_NAME " is opened\n");
+       return 0;
+}
+
+static void set_use_dec(void *data)
+{
+       pr_info(LIRC_DRIVER_NAME " is closed\n");
+}
+
 /*
  * Header space pulse
  * + pre_data space pulse pairs
@@ -298,8 +310,12 @@ static struct lirc_driver driver = {
        .name           = LIRC_DRIVER_NAME,
        .minor          = -1,
        .code_length    = 1,
+       .sample_rate    = 0,
        .data           = NULL,
+       .add_to_buf     = NULL,
        .rbuf           = &rbuf,
+       .set_use_inc    = set_use_inc,
+       .set_use_dec    = set_use_dec,
        .fops           = &lirc_fops,
        .dev            = NULL,
        .owner          = THIS_MODULE,
I will test to see if it actually sends pulses and works in the following days.
You're right, mad_ady. :)
lirc core drivers are adjusted from kernel 4.13 and "set_use_inc" and "set_use_dec" of struct lirc_driver are removed from kernel 4.14 version.
So, to support N1 kernel, lirc_odroid driver from xu4 4.9 kernel is suitable.
Nice work!

User avatar
mad_ady
Posts: 5113
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1
Location: Bucharest, Romania
Contact:

Re: IR Blaster for N1

Unread post by mad_ady » Fri Dec 21, 2018 3:47 pm

Blaster seems to work fine - which means I'm one step closer to getting the n1 into production.
Thank you for all your help!

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 1 guest