Action Item #557

Port XimbaRadio

Added by Hammel almost 4 years ago. Updated 7 months ago.

Status:ClosedStart date:23 Oct 2016
Priority:ImmediateDue date:
Assignee:Hammel% Done:

100%

Category:-
Target version:PiBox - 1.1.0 - Upgrades
Severity:04 - Low

Description

Either run it with Perl (as it is now) or port the library to C and call from XimbaRadio app.

Associated revisions

Revision 1dd52064
Added by Hammel almost 4 years ago

RM #557: Initial import of pixm, the PiBox XMPCR app.

Revision 1dd52064
Added by Hammel almost 4 years ago

RM #557: Initial import of pixm, the PiBox XMPCR app.

Revision 32d30274
Added by Hammel almost 4 years ago

RM #557: Cleanup packaging.

Revision 32d30274
Added by Hammel almost 4 years ago

RM #557: Cleanup packaging.

Revision 04df8e96
Added by Hammel almost 4 years ago

RM #557: Cleanup icon handling so UI displays correctly on Pi.

Revision 04df8e96
Added by Hammel almost 4 years ago

RM #557: Cleanup icon handling so UI displays correctly on Pi.

Revision eb0c5900
Added by Hammel almost 4 years ago

RM #557: Major cleanup to deal with dropped bytes.

Revision eb0c5900
Added by Hammel almost 4 years ago

RM #557: Major cleanup to deal with dropped bytes.

Revision 190c34b0
Added by Hammel almost 4 years ago

RM #557: Re-enable channel scans after a period of time. This updates the entire category/channel listsing
periodically.

Revision 190c34b0
Added by Hammel almost 4 years ago

RM #557: Re-enable channel scans after a period of time. This updates the entire category/channel listsing
periodically.

Revision 1e7a91d7
Added by Hammel almost 4 years ago

RM #557: Set a maximum retry on getting a response before timing out and returning a failure. This allows the
caller to retry or fail gracefully.

Revision 1e7a91d7
Added by Hammel almost 4 years ago

RM #557: Set a maximum retry on getting a response before timing out and returning a failure. This allows the
caller to retry or fail gracefully.

Revision 67e7b9e5
Added by Hammel almost 4 years ago

RM #557: Allow ttyusb ports to be grouped by "nobody" so unprivileged apps can access those
ports.

Revision 093b22e6
Added by Michael J. Hammel 7 months ago

RM #557: Change channelMgr thread to complete setup, then spin repeatedly through the list of requests to the device. Fix UI to be more responsive, primarily by fixing thread accesses and, more importantly, fixing how get_packet() operates. Make all commands open and setup the port, issue the command and get response, then close the port instead of leaving the port open all the time (which causes data corruption). Add pixm to appmgr.priv on installation to guarantee port access.

Revision 093b22e6
Added by Michael J. Hammel 7 months ago

RM #557: Change channelMgr thread to complete setup, then spin repeatedly through the list of requests to the device. Fix UI to be more responsive, primarily by fixing thread accesses and, more importantly, fixing how get_packet() operates. Make all commands open and setup the port, issue the command and get response, then close the port instead of leaving the port open all the time (which causes data corruption). Add pixm to appmgr.priv on installation to guarantee port access.

Revision 4cccad9d
Added by Michael J. Hammel 7 months ago

RM #557: Code cleanup - remove extraneous code.

Revision 4cccad9d
Added by Michael J. Hammel 7 months ago

RM #557: Code cleanup - remove extraneous code.

History

#1 Updated by Hammel almost 4 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

Some links of interest:

#2 Updated by Hammel almost 4 years ago

  • % Done changed from 10 to 70

This is done though it's not been tested as a package on hardware. But the app works fine on my laptop. I like it better than the old XimbaRadio. The new UI is simpler and matches the UI of VideoFE. Sadly the audio is output over an external audio port, not via the USB. I should be able to hook a Bluetooth transmitter to it, however.

Next up:
  1. Verify packaging
    1. Make sure the required app files are available
  2. Test on hardware
    1. can the RPi Model 2 drive this box? The external hub should be able to.
    2. Does the ttyUSB port come up as expected under PiBox?

#3 Updated by Hammel almost 4 years ago

  • % Done changed from 70 to 80

Packaging cleaned up and now builds correctly.

#4 Updated by Hammel almost 4 years ago

Testing on hardware:
  1. The UI needs to set the labels right justified but not expanded/filled.
  2. The UI needs the text fields for station, etc. expanded and filled.
  3. The UI needs a field to show "device not available" when initialization doesn't work. A button (say "R" for restart/reload) should cause the device init and channelMgr thread to be started again, after the device is setup.
  4. The ttyUSB port is missing.
    1. http://www.sealevel.com/support/article/AA-00524/0/How-to-configure-USB-serial-adapters-in-Linux.html
    2. https://www.kernel.org/doc/Documentation/usb/usb-serial.txt

#5 Updated by Hammel almost 4 years ago

Ugh. More power supply issues. The radio works fine on my laptop but doesn't work on my desktop with an external, powered USB hub. It also doesn't work on the Raspberry Pi either directly connected or connected to the external USB hub. I need to measure USB power to see if this might really be the problem. I can try this: https://www.amazon.com/Centech-USB-Power-Meter/dp/B00DAR4ITE

Here is yet more research on power to USB ports:
  1. https://jarretdyrbye.wordpress.com/2013/12/31/a-diy-power-supply-for-hi-fi-usb-audio-with-your-raspberry-pi/
  2. http://forum.allaboutcircuits.com/threads/stabilizing-a-usb-5v-in-reality-anywhere-from-4-5-to-5-5-power-source-to-a-true-5v-source.117217/
  3. http://plugable.com/2013/07/22/usb-hubs-and-chargers-what-happens-when-you-pull-too-much-power/
  4. http://electronics.stackexchange.com/questions/12935/stability-of-usb-5v-output
  5. http://www.howtogeek.com/228869/how-to-monitor-your-usb-device-power-usage-and-output/

#6 Updated by Hammel almost 4 years ago

Stabilizing power might be possible by placing a big capacitor (100-1000uF perhaps) inline to the power line on the usb connection. Sparkfun has a tutorial on using capacitors. I should also check with Plugable's support, which has info on how they handle power to USB ports.

#7 Updated by Hammel almost 4 years ago

It's now working on the Pi! But there are some tweaks to make.
  1. Update the UI as the channel scan is in progress.
  2. When a rescan is done, rebuild the category list
  3. The /dev/ttyUSB0 port needs to have "other" read perms. But why?
  4. The current channel should be scanned often to update on the UI.

#8 Updated by Hammel almost 4 years ago

  • Project changed from PiBox to pixm
  • Category deleted (04 - Applications)

#9 Updated by Hammel over 1 year ago

  • Target version changed from 0.12.0 to 1.1.0 - Upgrades

#10 Updated by Hammel 8 months ago

  • Priority changed from Urgent to Immediate
  • Severity changed from 01 - Critical to 04 - Low

#11 Updated by Hammel 7 months ago

Here are the updates to be made for each tweak.

Update the UI as the channel scan is in progress.

  1. mgrProcessor should be turned into a g_timeout_add() to simplify things. It just needs to run on a periodic basis and shutdown can just kill the timer.
    1. If the timer goes off but the last mgrProcessor is not complete then it should skip that iteration.
    2. mgrProcessor should rescan the current channel in one of its passes.
  2. when mgrProcessor completes it needs to call populateList
  3. populateList must do a gtk_widget_queue_draw(GTK_WIDGET()) which is probably needed because the widget update is happening outside the event main loop.

When a rescan is done, rebuild the category list

This isn't necessary as every response is checked to see if a new category has been found. However, addCategory() probably needs to support more than 256 categories.

The /dev/ttyUSB0 port needs to have "other" read perms. But why?

pixm needs to run privileged so it needs to be added to appmgr.priv by the postinst script in the opkg.

The current channel should be scanned often to update on the UI.

This is a new mode to add to mgrProcessor. We need to scan the current channel once a second or so. If we're using a g_timeout then every fourth time through (or so) should be a rescan of the current channel.

#12 Updated by Hammel 7 months ago

  • % Done changed from 80 to 90

The UI scan can't update the display on changes to the lists because the user can't select anything if that happens. So TAB is the only way to do that right now and that's they way it's going to stay.

The current channel update exposed major problems with how the device was being queried for data and when the UI would be updated. This required changes to how the device is queried, how the port would be opened/closed on a per command basis, and how the channelMgr thread would iterate through its operations. These are all fixed and the result appears to be, at least on my little (Chrome) laptop, much better performance and responsiveness.

This code is tested, committed and pushed. But there is a bunch of cleanup still to be done. So this isn't quite done yet.

#13 Updated by Hammel 7 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

Okay, code cleaned up. Retested and validated as working (quite well, actually).

Committed, tested and pushed.

Closing issue.

Also available in: Atom PDF