📜 ⬆️ ⬇️

Review and programming for stationary Internet radio

A few years ago I was already posting an article about how to make a network sound card from a router. That option required the presence of an active sound source and speakers. The portable version would look too cumbersome, because it was decided to purchase the finished product. Due to availability and as the cheapest possible option (50 euros), I chose renkforce IR 1 .


image


Of the key characteristics, the following were important to me:



image


DLNA


The presence of DLNA allows you to directly redirect the sound from Linux to Internet radio. This can be done in at least three ways:



Read more about these methods here .


You can also play music straight from your Android phone. DLNA support was found only in Samsung's music player preinstalled on the phone. I tried to find music players with DLNA support on Google Play, but without success.


WiFi


The only minor drawback is the lack of support for the 802.11n protocol.


Sound


The sound for this category of device is quite decent (one column at 10W). I'm not an audiophile, but the difference with the speakers built into a regular laptop is significant. Bass is present, jazz sounds great, rock and electronic music too. There is an option with two columns (model renkforce IR 2 ), but I did not consider it as superfluous.


Screen


The screen is ordinary. The interface is quite friendly ...


image


However, the procedure for adding your own radio stations leaves much to be desired.


Playlist


Because of the playlist, I decided to write this article. Manually typing in the URL of the radio station using the remote control or the scroll wheel is something else. The order of appearance of characters when using the numeric buttons on the remote control is very different from that used to typing SMS in a button phone (for 2 this is the sequence "2 ABC ab c", etc.). If you use the scroll wheel, you have to scroll through each character of the alphabet. I decided to analyze whether it is possible to add a playlist via the web interface.


The web interface has been curtailed. The open 80th port with the title AirMusic shows only the signatures to the settings. HTML refers to non-existent CSS styles on port 8080. The 8080 port itself displays 404 Not Found by default.


Fortunately, the telnet port was available. Using root login and password password, I managed to access the built-in busybox. The study of the internal structure gave the following information:



UIProto saves the playlist favorites in binary format to the file / flash / myradio.cfg . It is possible to read it through the terminal output, but only as text. To get the file completely had a little bit sweat. Fortunately, the busybox on the radio is compiled with support for the ftpput and ftpget commands . I used them to copy the file to a computer for further study, after setting up an FTP server.


Analyzed a binary file with the xxd (1) utility. Approximately the file structure looks like this:


Amount of entries: 2b Every entry len: 366b 0x00: 1b 0x00|0x02|0x03: 1b 0x20 (32): 1b 0x00: 6b 0x07|0x05: 1b len(0xTITLE+1): 1b 0x80: 1b 0xTITLE: 40b 0x00: 59b 0xURL: 250b 0x00: 5b 0x00: 2b 

I do not exclude that some elements in the structure are ordinary garbage from non-zero allocated memory. The use of zeros in these elements does not affect the final result.


The original version of the utility in C kept a hard-to-do playlist. To store the structure in the utility's memory, I used single-linked lists. The result of the first launch gave a test binary playlist, which I downloaded to the device. Even with zeros in elements of the structure unknown to me, the new playlist was successfully read. The final version of the utility reads a playlist from a CSV file and writes it in a binary format. A nice bonus was the use of headers for radio stations instead of their URLs (previously, radio stations in the list were displayed as http://1.2.3.4:8080/radio.mp3 ).


In conclusion, for the sake of experiment, I tried to compile a static native binary that could run straight on the radio itself. There is no practical benefit from this, but you can try to write an httpd daemon that will allow you to edit radio stations straight through the web interface. A more global and unrealizable idea is to write a fully opensource firmware for Internet radio.


How to make UIProto re- read the playlist after the update, I did not understand. I use hardcore method - sync and reboot.


For the convenience of downloading a playlist to the radio, I wrote scripts that use expect (1) .


USB


There is a non-soldered USB on the board. Judging by the dmesg (1) , it is quite efficient. To test its performance in practice has not had time.


image


Links



')

Source: https://habr.com/ru/post/306850/


All Articles