Re: Protocol

Marcus Brinkmann <[email protected]>
Newsgroups gmane.comp.audio.netmd.devel
Message-ID <20030102213557.GB407@ulysses>
On Thu, Jan 02, 2003 at 09:00:37PM -0000, Neil Deadman wrote:
> That is some real good work you've done. Any chance you could produce a
> proper document that we can download and read properly (one where it can
> be printed without ruining formatting)?
> 
> If you've got lots more to write then either wait or do a work in
> progress file?

Well, of course that's the whole goal of the exercise.

Here is what I am currently working on.  Note that it only includes facts.
The assumptions of data format etc is visible in how I group the bytes in
the string, but that's about all.  Because it only contains facts, it is
probably not correct.  For example, it might say 00 $t for track instead
giving the track argument two bytes.  But I think that collecting all facts
we can get at is the first required step.  Then the facts have to be
verified for the other devices (I only have a Sony MZ-N707), and also with
future devices, too.

When we have a better understanding of the meaning of the format, we might
add the ramblings in the other posts into a hypothetical "Interpretation"
section.  The formatting will be texinfo, but for now it's good old ASCII.
It's limited to 78 characters, so it should be printable by every printer I
can reasonably expect you to have ;)

If you own a device, you can help by verifying if what I write is true for
your device.  For this, you could use the small program I am using.  If you
want to do that, drop me an email.  Otherwise I will clean up a couple of
things before releasing it.

Thanks,
Marcus

Sony NetMD Protocol
===================

The Sony NetMD protocol is used to control a Sony MiniDisk player or
compatible device over USB.

The following devices support this protocol:

		Vendor ID	Product ID
Sony MZ-N1	0x54c		0x75
Sony (unknown)	0x54c		0x80
Sony (unknown)	0x54c		0x81
Sony MZ-N505	0x54c		0x84
Sony MZ-S1	0x54c		0x85
Sony MZ-N707	0x54c		0x86

The vendor and product ID are used to automatically identify the
device connected to the USB port.


Notation
========
00 - ff are hexadecimal bytes
?g - ?z are arbitrary values
#g - #z are parameters or otherwise interesting values
!g - !z are return values
<data> - an arbitrary long sequence of bytes


Get Disc Title
==============

=> ?g ?h  06  02  20 18 01 ?i 00  30 00 0a 00  ff ?j ?k ?l 00 00
                              #q                           #r #r

<= 09 ?h  06  02  20 18 01 ?i 00  30 00 0a 00  10 ?j !u !v 00 00
   !w !x 00 0a !y !z <data>

Retrieve the raw title of the minidisc.  <data> is the title (or
nothing if no title), !y!z is the length of <data>, !w!x is !y!z + 4
and !u!v is !y!z + 2.

NOTE: It seems !u!v overflows at 0x00d8 (and is 0x00d8 for all
      !y!z >= 0x00d2).

NOTE: It seems the reply is truncated to at most 0xff bytes?

* If #q is 01, then the wchar option is enabled.

* If #r is not 00 00, then !u!v is 00 00, and reply is truncated (as
  long as the request).

* If the minidisc player supports groups, the raw title is in the format
  0;TITLE//G1S-G1E;GROUP1//G2S-G2E;GROUP2//..//
  and GXS/GXE are the start and end track of group X.


Get Disc Flags
==============

=> ?g ?h  06  01  10 10 00  ff ?i 00 01 00 0b

<= 09 ?h  06  01  10 10 00  10 ?i 00 01 00 0b  !u

Retrieve the disc flags in !u.  !u is a bit-wise OR of the following
values: 0x40 write protection is active, 0x10 the disc is recordable.

If no disc is inserted, 0x40 is returned.


Get Track Title
===============

=> ?g ?h  06 02  20 18 02 00 $t  30 00 0a 00  ff ?j ?k ?l 00 00
                          #q #r                            #s #s

<= 09 ?h  06 02  20 18 02 00 $t  30 00 0a 00  10 ?j !u !v 00 00
   !w !x 00 0a !y !z <data>

Retrieve the title of track $t (the first track is track 0), or the
disc title if $t is ff.  <data> is the title (or nothing if no title),
!y!z is the length of <data>, !w!x is !y!z + 4 and !u!v is !y!z + 2.

NOTE: It seems !u!v overflows at 0x00d8 (and is 0x00d8 for all
      !y!z >= 0x00d2).

NOTE: It seems the reply is truncated to at most 0xff bytes?

NOTE: If #r is not 00, then a 0a error is returned.  This indicates
      that this byte is reserved for support of more than 255 tracks.

* If #q is 03, then the wchar option is enabled.

* If #s is not 00 00, then !u!v is 00 00, and reply is truncated (as
  long as the request).


Get Track Flags
===============

=> ?g ?h  06 01  20 10 01 00 $t  ff ?i  00 01 00 08
                          #q

<= 09 ?h  06 01  20 10 01 00 $t  10 ?i  00 01 00 08  !u

Retrieve the flags for the track $t in !u.  00 indicates an ATRAC
encoded track, 03 an ATRAC3 encoded track.

NOTE: If #r is not 00, then a 0a error is returned.  This indicates
      that this byte is reserved for support of more than 255 tracks.


Get Track Info
==============

Length:

=> ?g ?h  06 02  20 10 01 00 $t  30 00 01 00  ff ?i  00 00 00 00
                          #q

<= 09 ?h  06 02  20 10 01 00 $t  30 00 01 00  10 ?i  00 0c 00 00
   00 0a 00 01 00 06 00 00 !u !v !w !x

Retrieve the length of track $t and return it in the BCD encoded
format HH MM SS FF (hours, minutes, seconds, frames) in !u !v !w !x.

NOTE: If #q is not 00, then a 0a error is returned.  This indicates
      that this byte is reserved for support of more than 255 tracks.


Bitrate:

=> ?g ?h  06 02  20 10 01 00 $t  30 80 07 00  ff ?i  00 00 00 00
                          #q

<= 09 ?h  06 02  20 10 01 00 $t  30 80 07 00  10 ?i  00 0a 00 00
   00 08  80 07 00 04  01 10 !u !v

Retrieve the bitrate of track $t and return it in !u an !v.
The value for !u is 90 for SP, 92 for LP2 and 93 for LP4.
The value for !v is 00 for stereo and 01 for Mono.

NOTE: If #q is not 00, then a 0a error is returned.  This indicates
      that this byte is reserved for support of more than 255 tracks.


Device Status Message
=====================

00 18  09  80 01  02  30 88 00 00  30 88 04 00  ff  00  00 00 00 00
09 18  09  80 01  02  30 88 00 00  30 88 04 00  10  00  00 09 00 00
00 07  88 04  00 03  X1 ff 40

X1	0x40	Disk Present
	0x80	No Disk Present
	0x??	unknown


Playback Status
===============

Type A
00 18  09  80 01  03  30 88 01 00  30 88 05 00  30 88 07 00 ff 00 00 00 00 00
09 18  09  80 01  03  30 88 01 00  30 88 05 00  30 88 07 00 10 00 00 0e 00 00
00 0c  88 05  00 08  80 e0  01 10  90 00  40 00

Type B
00 18  09  80 01  03  30 88 02 00  30 88 05 00  30 88 06 00 ff 00 00 00 00 00
09 18  09  80 01  03  30 88 02 00  30 88 05 00  30 88 06 00 10 00 00 08 00 00
00 06  88 06  00 02  xx yy

xx yy  	c3 7d	paused
	c3 75	play
	c3 3f	ff
	c3 4f	rew
	c5 ff	stopped


Playback Position
=================
00 18  09  80 01 04  30 88 02 00  30 88 05 00  30 00 03 00  30 00 02 00
   ff 00 00 00 00 00
09 18  09  80 01 04  30 88 02 00  30 88 05 00  30 00 03 00  30 00 02 00
   10 00 00 0d 00 00  00 0b  00 02  00 07  00 00 tt TT TT TT TT

tt track
TT playback pos

0a at blank disc


Set Playback Track
==================

00 18  50 ff 01  00 00  00 00  tt tt  TT TT TT TT

tt tt  Track Nr
TT TT TT TT time


Start Playback
==============

00 18  c3 ff  75  00 00 00
09 18  c3 00  75  00 00 00

Pause Playback
==============

00 18  c3  ff 7d 00 00  00
09 18  c3  00 7d 00 00  00

Start Fast Forward
==================

00 18  c3  ff 39 00 00  00
09 18  c3  00 39 00 00  00

Start Fast Rewind
=================

00 18  c3  ff 49 00 00  00
09 18  c3  00 49 00 00  00

Stop Playback
=============

00 18  c5  ff 00 00 00  00
09 18  c5  00 00 00 00  00

Toc Sync
========

00 18 08  10 18 02 00  00
09 18 08  10 18 02 00  00

Toc Cache
=========

00 18 08  10 18 02 03  00
09 18 08  10 18 02 03  00


Track Count
===========

=> 00 18  06  02  10 10 01  30 00 10 00  ff  00  00 00 00 00
<= 09 18  06  02  10 10 01  30 00 10 00  10  00  00 08 00 00  00 06  00 10
   00 02  00 X1

X1:	number of tracks

Disc Capacity
=============

(28 bytes)

00 18  06  02  10 10 00  30 80 03 00  ff  00  00 00 00 00
09 18  06  02  10 10 00  30 80 03 00  10  00  00 1d 00 00 00 1b
80 03 00 17  80 00
00 05 00 tt tt tt tt	time used (actual seconds of music)
00 05 00 tt tt tt tt	total disk size (if recorded in SP)
00 05 00 tt tt tt tt	available disk size (if recorded in SP)

time coding:  HH:MM:SS:FF in BCD (!= track length)

Track Set Title
===============

00 18  07 02  20 18 02 tt tt  30 00 0a 00  50 00 ll ll  00 00  oo oo  D

09 18  07 02  20 18 02 tt tt  30 00 0a 00  50 00 ll ll  00 00  oo oo

ll new len
oo old len
D new title

Set Title
=========

00 18  07 02  20 18 01 00 00  30 00 0a 00  50 00 ll ll 00 00  oo oo  D

09 18  07 02  20 18 01 00 00  30 00 0a 00  50 00 ll ll 00 00  oo oo

ll new len
oo old len
D new title

Move Track
==========

00 18  43 ff 00 00  20 10 01 ss ss  20 10 01 dd dd

09 18  43 00 00 00  20 10 01 ss ss  20 10 01 dd dd

Disc Init
=========

00 18 40  ff 00 00
09 18 40  00 00 00

Delete Track
============

00 18  40 ff 01 00  20 10 01 tt tt

09 18  40 00 01 00  20 10 01 tt tt



???
===

Recording:

00 18 00  08 00 46 f0  03 01 03 11  ff

09 18 00  08 00 46 f0  03 01 03 11 00 01 00 00 0a bc a8 00 00


00 18 00  08 00 46 f0  03 01 03 12  ff 00 38  00 00 00 38
 00 00 00 01  00 00 00 09  00 01 00 01  00 00 ...
   
00 18 00  08 00 46 f0  03 01 03 12  01 00 38  00 00 00 38


00 18 00  08 00 46 f0  03 01 03 20  ff 00 ...
                                22  ff 00 ...
                                28  ff 00 01 00 10  move to end and start rec
				   01 ff ff 00 94 02 00 00 43 8c 00 32 bc 50

0f 18 00  08 00 46 f0  03 01 03 28  00 00 01 00 ...
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.