Jump to content
Flirc Forums

Bought a Flirc Gen 2 and it behaves very strange


PeterC

Recommended Posts

Hello!

I just recently bought a Flirc Gen 2 and it behaves very strange.

Almost every time I boot my computer (Debian Buster) the Flirc device is not recognized and I see this in journalctl:

kernel: usb 3-2: device descriptor read/64, error -110
kernel: usb 3-2: device descriptor read/64, error -110
kernel: usb usb3-port2: attempt power cycle
kernel: usb 3-2: new full-speed USB device number 4 using uhci_hcd
kernel: usb 3-2: device not accepting address 4, error -110
kernel: usb 3-2: new full-speed USB device number 5 using uhci_hcd
systemd-udevd[307]: usb3: Worker [311] processing SEQNUM=1761 is taking a long time
kernel: usb 3-2: device not accepting address 5, error -110
kernel: usb usb3-port2: unable to enumerate USB device

If I unplug and then plug the Flirc back again it will be recognized.

And when I run 'flirc_util settings' I get:
3.25.3
FW Version: v4.9.3
[E] lib/libtransport/transport.c _dev_send_cmd(223): Wrong response: 'ir_state'
[E] lib/libflirc/firmware/fw_4.0.c fl_ver4_header_peek(50): invalid address you idiot
   SKU:     Flirc 2.0 [dori]
[E] lib/libtransport/hid.c hid_recv_packet(161): Wrong response length = 33
[E] lib/libtransport/hid.c hid_recv_packet(162): hidapi: (null)
[E] lib/libtransport/transport.c _recv_packet(126): _recv_packet: recv packet error = -1
[E] lib/libtransport/transport.c _dev_send_cmd(201): recv timeout
[E] lib/libtransport/hid.c hid_recv_packet(167): hid_recv_packet: wrong report id
[E] lib/libtransport/hid.c hid_recv_packet(168): hidapi: (null)
[E] lib/libtransport/transport.c _recv_packet(126): _recv_packet: recv packet error = -1
[E] lib/libtransport/transport.c _dev_send_cmd(201): recv timeout
   Hash:    0xCB185BDE

Settings:
  sleep detection:  always enabled
  noise canceler:   always enabled
  inter-key delay:  N/A for current firmware
  variant:          Flirc
  builtin profiles: NA
  Memory Info:      NA
  product sku:      Flirc 2.0 [dori]

Recorded Keys:
Index  hash       IK   ID  key
-----  --------   ---  --  ------------
    0  880AE241   130  01  0
 

And for 'flirc_util unit_test' I get:
[E] lib/libtransport/hid.c hid_recv_packet(161): Wrong response length = 33
[E] lib/libtransport/hid.c hid_recv_packet(162): hidapi: (null)
[E] lib/libtransport/transport.c _recv_packet(126): _recv_packet: recv packet error = -1
[E] lib/libtransport/transport.c _dev_send_cmd(201): recv timeout
[E] lib/libflirc/firmware/fw_4.7.c _fl_transmit_raw(83): error sending data, ceck device log
[E] lib/libtransport/hid.c hid_recv_packet(167): hid_recv_packet: wrong report id
[E] lib/libtransport/hid.c hid_recv_packet(168): hidapi: (null)
[E] lib/libtransport/transport.c _recv_packet(126): _recv_packet: recv packet error = -1
[E] lib/libtransport/transport.c _dev_send_cmd(201): recv timeout
[E] lib/libflirc/firmware/fw_4.2.c _fl_unit_test(132): error recording test0
Flirc Not Okay

Any help would be extremely appreciated!

Best regards,
Peter Carlsson

Link to comment
Share on other sites

This time when booting the computer I got this:

flirc_util unit_test
Flirc Okay

flirc_util settings
3.25.3
FW Version: v4.9.3
   SKU:     Flirc 2.0 [dori]
   Branch:  master
   Config:  release
   Hash:    0xCB185BDE

Settings:
  sleep detection:  always enabled
  noise canceler:   always enabled
  inter-key delay:  N/A for current firmware
  variant:          Flirc
  builtin profiles: NA
  Memory Info:      NA
  product sku:      Flirc 2.0 [dori]

Recorded Keys:
Index  hash       IK   ID  key
-----  --------   ---  --  ------------

But the recorded keys are missing.

Link to comment
Share on other sites

Hello again!

Just after I posted the last reply, Debian released an update to Buster (10.3) so here is the output again:

uname -a
Linux htpc 4.19.0-8-686-pae #1 SMP Debian 4.19.98-1 (2020-01-26) i686 GNU/Linux

flirc_util settings
3.25.3
FW Version: v4.9.3
[E] lib/libtransport/transport.c _dev_send_cmd(223): Wrong response: 'ir_state'
[E] lib/libflirc/firmware/fw_4.0.c fl_ver4_header_peek(50): invalid address you idiot
   SKU:     Flirc 2.0 [dori]
[E] lib/libtransport/hid.c hid_recv_packet(161): Wrong response length = 33
[E] lib/libtransport/hid.c hid_recv_packet(162): hidapi: (null)
[E] lib/libtransport/transport.c _recv_packet(126): _recv_packet: recv packet error = -1
[E] lib/libtransport/transport.c _dev_send_cmd(201): recv timeout
[E] lib/libtransport/hid.c hid_recv_packet(167): hid_recv_packet: wrong report id
[E] lib/libtransport/hid.c hid_recv_packet(168): hidapi: (null)
[E] lib/libtransport/transport.c _recv_packet(126): _recv_packet: recv packet error = -1
[E] lib/libtransport/transport.c _dev_send_cmd(201): recv timeout
   Hash:    0xCB185BDE

Settings:
  sleep detection:  always enabled
  noise canceler:   always enabled
  inter-key delay:  N/A for current firmware
  variant:          Flirc
  builtin profiles: NA
  Memory Info:      NA
  product sku:      Flirc 2.0 [dori]
Recorded Keys:
Index  hash       IK   ID  key
-----  --------   ---  --  ------------
    0  CB4837F1   130  01  d
    1  CF32DFB0   130  01  i
    2  42E4A325   116  01  escape
    3  67EC17FD   130  01  m
    4  B64D7ABD   116  01  return
    5  BE6018B0   130  01  up
    6  361F4CE4   130  01  left
    7  BE6017C9   130  01  down
    8  3B263EB1   130  01  right
    9  E79BD7A4   130  01  u
   10  4B7A5A31   130  01  j
   11  411EB1E4   130  01  p

I recorded my remote once again after the first disappeared. However, I notice that almost every button I press I need  to press twice for the computer to react. So I would definitely say that something is wrong, either with the Flirc, the computer or a combination. I would be happy to provide more information if that helps to solve my problem.

By the way, I read in the documentation that there should be some predefined settings for Logitech remotes. The one I have is a Harmony One+ but I could not find it in the menu. So that is why I use the full size keyboard layout for recording.

Best regards,
Peter Carlsson

Link to comment
Share on other sites

 

I have only seen this in one place before, which is on Cortex ARM-A7's, there seems to be a bug in the upstream kernel. The only way I was able to circumvent this was by increasing my USB-Poll time. I need to have time to continue to debug it, but it's a fairly complicated issue. 

I wouldn't rule out that there is something wrong with the hardware just yet. Can you try different ports on the computer? Is this a hub? Directly on the PC? USB 2.0, or 3.0 Hub?

The bug is just with the pairing software, should not prevent flirc from working correctly. The issue with the double record is most likely the protocol you have setup on the harmony. Some alternate patterns on every press to help detect when the user let go of the button, or someone walked in front of the remote. 

On the harmony software, add manufacturer Flirc, device: Kodi.

 

Link to comment
Share on other sites

Thanks for your quick response!

It is directly on the PC and I have tried different ports. Both USB 2.0 and 3.0. I need to have a 0.5m cable since the ports are at the back of the PC. The Flirc and the remote has clear sight and the distance is approximately 3m.

The double record was no issue before I bought the Flirc when I used ir-keytable but it had other issues.

Link to comment
Share on other sites

I was trying to start logging to file by following the example of creating a configuration file (/usr/bin/flirc.ini) and start the GUI but I can not find the log file. Is it supposed to be stored in /usr/bin/ if I don't enter any path in the ini-file?

Using for example 'flirc_util unit_test' it still spit out  errors but it kind of work although it still need two key presses for every command. And thats why I wanted the log file.

[E] lib/libtransport/transport.c _dev_send_cmd(223): Wrong response: 'getversion'
[E] lib/libflirc/firmware/fw_4.2.c _fl_unit_test(132): error recording test0
Flirc Not Okay
[E] lib/libtransport/transport.c _dev_send_cmd(223): Wrong response: 'getversion'

I also noticed that just after I executed the 'flirc_util unit_test' command the computer stopped responding to any commands from the remote control.

Best regards,
Peter Carlsson

Edited by PeterC
Link to comment
Share on other sites

Today when the PC started I got no response whatsoever from any commands from the remote control and when I tried with flirc_util I got:

flirc_util unit_test
Flirc Okay
htpc:~# flirc_util settings
3.25.3
FW Version: v4.9.3
   SKU:     Flirc 2.0 [dori]
   Branch:  master
   Config:  release
   Hash:    0xCB185BDE

Settings:
  sleep detection:  always enabled
  noise canceler:   always enabled
  inter-key delay:  N/A for current firmware
  variant:          Flirc
  builtin profiles: NA
  Memory Info:      NA
  product sku:      Flirc 2.0 [dori]

Recorded Keys:
Index  hash       IK   ID  key
-----  --------   ---  --  ------------

Now the list of recorded keys was empty again.

Link to comment
Share on other sites

The remote control is a Logitech Harmony One+.

The problem is that the setup is very unreliable and I don't know if it is the Flirc, the remote control, Debian Buster or a combination.

The remote control has worked without problem for several years together with Debian. But when Debian was upgraded from Stretch to Buster the drivers for my IR receiver stopped working. I then bought a Flirc.

The problems are several:

  1. It sometimes output errors when using flirc_util as I have posted above.
  2. It sometimes deletes the recorded keys and I have to do the configuration again.
  3. It almost always don't respond to the first press on the remote control. It needs a second press on the same button. I noticed that last time the recorded keys were deleted I have managed to record multiple entries for the enter key. But even before that I had to press twice for the remote command to be recognized by the computer.
Link to comment
Share on other sites

  • 2 months later...

I'm hitting this on a Raspberry Pi 4 running Arch Linux ARM and my desktop. The unit appears to be working fine. I can record keys and the input works but flirc_util is throwing those errors. I made sure to clone the latest sdk and build flirc_util there in case anything changed/weird incompatibility with the system.

------------------------------------------------------------------------------------------------------------------------------------------------------------

[parker@wolfcola cli]$ uname -a
Linux wolfcola 5.6.12-arch1-1 #1 SMP PREEMPT Sun, 10 May 2020 10:43:42 +0000 x86_64 GNU/Linux
[parker@wolfcola cli]$ ./buildresults/Linux_x86_64/gcc/flirc_util/release/flirc_util settings
flirc_util version 26e271e49325ec7e449a705e4d438c7d0426fd0d [26e271e]
Firmware Detected
FW Version: v4.6.2v4.6.2
   SKU:     Flirc 2.0 [dori]
   Branch:  master
   Config:  release
   Hash:    0x83E88D26

Settings:
 sleep detection:  always enabled
 noise canceler:   always enabled
 inter-key delay:  N/A for current firmware
 variant:          Flirc
 builtin profiles: NA
 Memory Info:      NA
 product sku:      Flirc 2.0 [dori]

Recorded Keys:
Index  hash       IK   ID  key
-----  --------   ---  --  ------------
   0  BAE960C9   052  01  up
[parker@wolfcola cli]$ ./buildresults/Linux_x86_64/gcc/flirc_util/release/flirc_util unit_test
[E] lib/libflirc/firmware/fw_4.0.c fl_ver4_set_interrupt(367): timeout
[E] lib/libflirc/firmware/fw_4.2.c _fl_unit_test(132): error recording test0
Flirc Not Okay

------------------------------------------------------------------------------------------------------------------------------------------------------------

 

And when I try on the Raspberry Pi

------------------------------------------------------------------------------------------------------------------------------------------------------------

[parker@alarmpi cli]$ sudo ./buildresults/Linux_armv7l/gcc/flirc_util/release/flirc_util settings
flirc_util version 26e271e49325ec7e449a705e4d438c7d0426fd0d [26e271e]
Firmware Detected
FW Version: v4.6.2v4.6.2
[E] lib/libtransport/hid.c hid_recv_packet(161): Wrong response length = 0
[E] lib/libtransport/hid.c hid_recv_packet(162): hidapi: (null)
[E] lib/libtransport/transport.c _recv_packet(126): _recv_packet: recv packet error = -1
[E] lib/libtransport/transport.c _dev_send_cmd(201): recv timeout
[E] lib/libflirc/firmware/fw_4.0.c fl_ver4_header_peek(50): invalid address you idiot
[E] lib/libtransport/hid.c hid_recv_packet(161): Wrong response length = 0
[E] lib/libtransport/hid.c hid_recv_packet(162): hidapi: (null)
[E] lib/libtransport/transport.c _recv_packet(126): _recv_packet: recv packet error = -1
[E] lib/libtransport/transport.c _dev_send_cmd(201): recv timeout
[E] lib/libflirc/firmware/fw_4.0.c fl_ver4_header_peek(50): invalid address you idiot
[E] lib/libtransport/hid.c hid_recv_packet(161): Wrong response length = 0
[E] lib/libtransport/hid.c hid_recv_packet(162): hidapi: (null)
[E] lib/libtransport/transport.c _recv_packet(126): _recv_packet: recv packet error = -1
[E] lib/libtransport/transport.c _dev_send_cmd(201): recv timeout
[E] lib/libflirc/firmware/fw_4.0.c fl_ver4_header_peek(50): invalid address you idiot


------------------------------------------------------------------------------------------------------------------------------------------------------------

 

When I try the official packaged flirc_util for armv7 (I had to install libreadline6). No keys and inconsistently running.

------------------------------------------------------------------------------------------------------------------------------------------------------------

[parker@alarmpi Flirc]$ sudo ./flirc_util settings
3.25.3
FW Version: v4.6.2v4.6.2
  SKU:     Flirc 2.0 [dori]
  Branch:  master
  Config:  release
  Hash:    0x83E88D26

Settings:
 sleep detection:  always enabled
 noise canceler:   always enabled
 inter-key delay:  N/A for current firmware
 variant:          Flirc
 builtin profiles: NA
 Memory Info:      NA
 product sku:      Flirc 2.0 [dori]

Recorded Keys:
Index  hash       IK   ID  key
-----  --------   ---  --  ------------
[parker@alarmpi Flirc]$ sudo ./flirc_util settings
3.25.3
FW Version: v4.6.2v4.6.2
[E] lib/libtransport/hid.c hid_recv_packet(161): Wrong response length = 0
[E] lib/libtransport/hid.c hid_recv_packet(162): hidapi: (null)
[E] lib/libtransport/transport.c _recv_packet(126): _recv_packet: recv packet error = -1
[E] lib/libtransport/transport.c _dev_send_cmd(201): recv timeout
[E] lib/libflirc/firmware/fw_4.0.c fl_ver4_header_peek(50): invalid address you idiot
^C
Cleaning up....
[parker@alarmpi Flirc]$ sudo ./flirc_util unit_test
[E] lib/libflirc/firmware/fw_4.0.c fl_ver4_set_interrupt(367): timeout
[E] lib/libflirc/firmware/fw_4.2.c _fl_unit_test(132): error recording test0
Flirc Not Okay

------------------------------------------------------------------------------------------------------------------------------------------------------------

 

EDIT: hidapi version on both machines is hidapi 0.9.0-1
 

Edited by parkerlreed
Link to comment
Share on other sites

13 hours ago, parkerlreed said:

I'm hitting this on a Raspberry Pi 4 running Arch Linux ARM and my desktop. The unit appears to be working fine. I can record keys and the input works but flirc_util is throwing those errors. I made sure to clone the latest sdk and build flirc_util there in case anything changed/weird incompatibility with the system.

------------------------------------------------------------------------------------------------------------------------------------------------------------

[parker@wolfcola cli]$ uname -a
Linux wolfcola 5.6.12-arch1-1 #1 SMP PREEMPT Sun, 10 May 2020 10:43:42 +0000 x86_64 GNU/Linux
[parker@wolfcola cli]$ ./buildresults/Linux_x86_64/gcc/flirc_util/release/flirc_util settings
flirc_util version 26e271e49325ec7e449a705e4d438c7d0426fd0d [26e271e]
Firmware Detected
FW Version: v4.6.2v4.6.2
   SKU:     Flirc 2.0 [dori]
   Branch:  master
   Config:  release
   Hash:    0x83E88D26

Settings:
 sleep detection:  always enabled
 noise canceler:   always enabled
 inter-key delay:  N/A for current firmware
 variant:          Flirc
 builtin profiles: NA
 Memory Info:      NA
 product sku:      Flirc 2.0 [dori]

Recorded Keys:
Index  hash       IK   ID  key
-----  --------   ---  --  ------------
   0  BAE960C9   052  01  up
[parker@wolfcola cli]$ ./buildresults/Linux_x86_64/gcc/flirc_util/release/flirc_util unit_test
[E] lib/libflirc/firmware/fw_4.0.c fl_ver4_set_interrupt(367): timeout
[E] lib/libflirc/firmware/fw_4.2.c _fl_unit_test(132): error recording test0
Flirc Not Okay

------------------------------------------------------------------------------------------------------------------------------------------------------------

 

And when I try on the Raspberry Pi

------------------------------------------------------------------------------------------------------------------------------------------------------------

[parker@alarmpi cli]$ sudo ./buildresults/Linux_armv7l/gcc/flirc_util/release/flirc_util settings
flirc_util version 26e271e49325ec7e449a705e4d438c7d0426fd0d [26e271e]
Firmware Detected
FW Version: v4.6.2v4.6.2
[E] lib/libtransport/hid.c hid_recv_packet(161): Wrong response length = 0
[E] lib/libtransport/hid.c hid_recv_packet(162): hidapi: (null)
[E] lib/libtransport/transport.c _recv_packet(126): _recv_packet: recv packet error = -1
[E] lib/libtransport/transport.c _dev_send_cmd(201): recv timeout
[E] lib/libflirc/firmware/fw_4.0.c fl_ver4_header_peek(50): invalid address you idiot
[E] lib/libtransport/hid.c hid_recv_packet(161): Wrong response length = 0
[E] lib/libtransport/hid.c hid_recv_packet(162): hidapi: (null)
[E] lib/libtransport/transport.c _recv_packet(126): _recv_packet: recv packet error = -1
[E] lib/libtransport/transport.c _dev_send_cmd(201): recv timeout
[E] lib/libflirc/firmware/fw_4.0.c fl_ver4_header_peek(50): invalid address you idiot
[E] lib/libtransport/hid.c hid_recv_packet(161): Wrong response length = 0
[E] lib/libtransport/hid.c hid_recv_packet(162): hidapi: (null)
[E] lib/libtransport/transport.c _recv_packet(126): _recv_packet: recv packet error = -1
[E] lib/libtransport/transport.c _dev_send_cmd(201): recv timeout
[E] lib/libflirc/firmware/fw_4.0.c fl_ver4_header_peek(50): invalid address you idiot


------------------------------------------------------------------------------------------------------------------------------------------------------------

 

When I try the official packaged flirc_util for armv7 (I had to install libreadline6). No keys and inconsistently running.

------------------------------------------------------------------------------------------------------------------------------------------------------------

[parker@alarmpi Flirc]$ sudo ./flirc_util settings
3.25.3
FW Version: v4.6.2v4.6.2
  SKU:     Flirc 2.0 [dori]
  Branch:  master
  Config:  release
  Hash:    0x83E88D26

Settings:
 sleep detection:  always enabled
 noise canceler:   always enabled
 inter-key delay:  N/A for current firmware
 variant:          Flirc
 builtin profiles: NA
 Memory Info:      NA
 product sku:      Flirc 2.0 [dori]

Recorded Keys:
Index  hash       IK   ID  key
-----  --------   ---  --  ------------
[parker@alarmpi Flirc]$ sudo ./flirc_util settings
3.25.3
FW Version: v4.6.2v4.6.2
[E] lib/libtransport/hid.c hid_recv_packet(161): Wrong response length = 0
[E] lib/libtransport/hid.c hid_recv_packet(162): hidapi: (null)
[E] lib/libtransport/transport.c _recv_packet(126): _recv_packet: recv packet error = -1
[E] lib/libtransport/transport.c _dev_send_cmd(201): recv timeout
[E] lib/libflirc/firmware/fw_4.0.c fl_ver4_header_peek(50): invalid address you idiot
^C
Cleaning up....
[parker@alarmpi Flirc]$ sudo ./flirc_util unit_test
[E] lib/libflirc/firmware/fw_4.0.c fl_ver4_set_interrupt(367): timeout
[E] lib/libflirc/firmware/fw_4.2.c _fl_unit_test(132): error recording test0
Flirc Not Okay

------------------------------------------------------------------------------------------------------------------------------------------------------------

 

EDIT: hidapi version on both machines is hidapi 0.9.0-1
 

There is a bug in the upstream kernel. Do your pairing on another machine. I don’t have time to debug the kernel. The Kernel is dropping USB packets. I’ve got a ton of debug logs that show it on the wire ,and the kernel stack never gets it.

The remedy is to slow down communication to the USB device. It’s possible to just push an update (which will have to be done on another machine), and the USB poll time increases and slows it down to fix it. But It slows it down considerably.

If you use the blue port on the pi, it has a phy in front of it, and doesn’t help mitigate it completely, but helps a lot.

Link to comment
Share on other sites

  • 3 weeks later...

I dug into this more, it's a generic linux kernel bug.

From: https://stackoverflow.com/questions/35728129/usb-hid-device-poll-interval-on-linux/36002731#36002731

Quote

Looks like this is because of a bug in Linux drivers for UHCI and some OHCI controllers. The driver doesn't process the TDs filled by the controller fast enough, so the controller must skip a SOH slot. As a result, interrupt transfers arrive only every second slot. If I insert USB 3.0 card into the same Linux, everything is fine because XHCI driver is used instead. If I run Windows on the same computer, everything is fine, because Windows doesn't have the bug.

Another Reference

Quote

Note: This only shows the polling interval requested by the device and not the actual interval being used. See BBS.

Report, this states there is a workaround, there is not.

An official kernel bug report: https://bugzilla.kernel.org/show_bug.cgi?id=60586 with a discussion on the topic: https://www.mail-archive.com/linux-usb@vger.kernel.org/msg24939.html

I will not be changing the polling time in firmware to accommodate for this stupid linux bug. There is a way to change the polling time for specific USB devices, but mainly keyboards and mice. Flirc is a USB HID device, so there is no specific way to do the custom generic HID interface polling override. However, there seems to be a possible way to do it by patching the kernel: https://gitlab.freedesktop.org/panfrost/linux/commit/2ddc8e2d2b5902b376fee51585c8eed72b8836e7

This may be the route I try. But it's not urgent, since the workaround is fairly easy, just set it up on another computer. But it looks like I can just compile a patched kernel module so we can override the poll time of flirc, include it in my package.

Free upcoming product for anyone willing to put the time in to the above to get the poll time override working on generic HID devices.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...