1 .\" $NetBSD: utoppy.4,v 1.3 2006/04/04 20:34:46 wiz Exp $
3 .\" Copyright (c) 2006 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Steve C. Woodford.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
35 .Nd USB driver for the Topfield TF5000PVR range of digital video recorders
37 .Cd "utoppy* at uhub? port ?"
43 driver provides support for the Topfield TF5000PVR range of DVB recorders
46 which are popular in Europe and Australia.
47 These recorders have a
49 device interface which can be used to transfer
50 recordings to and from the unit's hard disk.
53 interface can also be used to upload binary images for execution
54 on the Toppy's MIPS cpu.
58 protocol has not been officially documented by Topfield,
59 but the basic features have been reverse engineered by others in order
60 to write replacements for the official
62 download/upload program from Topfield.
64 Existing replacements for Altair suffer from the fact that they are
65 ultimately built on top of
67 This has a number of detrimental side-effects:
70 Performance suffers since all Toppy command packets have to cross the
71 user-kernel interface.
73 The userland programs are full of clutter to deal with interpreting the
74 command/status packets, not to mention byte-swapping and host endian
77 Signals can interrupt a data transfer at a critical point, leaving the
78 Toppy in an undefined state.
79 For example, interrupting a download with
81 mode enabled will leave the Toppy completely unresponsive to the remote
82 control, and prevent timer-based recordings from starting.
87 driver provides a clean and stable interface to the Toppy protocol, and
88 ensures that an interrupt caused by a signal does not leave the Toppy in
91 Use the following header file to get access to the
93 specific structures and defines.
95 #include \*[Lt]dev/usb/utoppy.h\*[Gt]
100 driver can be accessed through the
103 The primary means of controlling the driver is by issuing a series of
105 system calls followed by
109 system calls as appropriate.
113 commands are supported by the
116 .Bl -tag -width xxxxxx
117 .It Dv UTOPPYIOTURBO Fa "int *mode"
118 This command can be used to enable or disable
123 .Dv UTOPPYIOWRITEFILE
124 commands (see below).
127 is non-zero, Turbo mode will be enabled.
128 Otherwise Turbo mode will be disabled.
129 In non-Turbo mode, the Toppy's
131 interface is capable of sustaining around 5.6 Mbit/s during a file transfer.
132 With Turbo mode enabled, it can sustain just over 16 Mbit/s.
133 Of course, these figures are valid only if the Toppy is connected via a
136 Performance using an older
138 1 interface will be significantly lower.
139 .It Dv UTOPPYIOCANCEL Fa void
140 This command can be used to abort an in-progress
141 .Dv UTOPPYIOREADDIR ,
142 .Dv UTOPPYIOREADFILE ,
144 .Dv UTOPPYIOWRITEFILE
146 .It Dv UTOPPYIOREBOOT Fa void
147 This command will cause the Toppy to reboot cleanly.
148 .It Dv UTOPPYIOSTATS Fa "struct utoppy_stats *stats"
149 This command retrieves statistics for the Toppy's hard disk.
151 struct utoppy_stats {
152 uint64_t us_hdd_size; /* Size of the disk, in bytes */
153 uint64_t us_hdd_free; /* Free space, in bytes */
156 .It UTOPPYIORENAME Fa "struct utoppy_rename *rename"
157 This command is used to rename a file or directory on the Toppy's
159 The full pathname to each file must be provided.
161 struct utoppy_rename {
162 char *ur_old_path; /* Path to existing file */
163 char *ur_new_path; /* Path to new file */
166 .It UTOPPYIOMKDIR Fa "char *path"
167 This command creates the directory specified by
169 .It UTOPPYIODELETE Fa "char *path"
170 This command deletes the file or directory specified by
172 .It UTOPPYIOREADDIR Fa "char *path"
173 This command initiates a read of the contents of the directory specified by
175 After issuing this command, the directory contents must be read using
181 will transfer one or more directory entries into the user-supplied buffer.
182 The buffer must be large enough to receive at least one directory entry.
185 returns zero, all directory entries have been read.
187 A directory entry is described using the following data structure:
189 struct utoppy_dirent {
190 char ud_path[UTOPPY_MAX_FILENAME_LEN + 1];
192 UTOPPY_DIRENT_UNKNOWN,
193 UTOPPY_DIRENT_DIRECTORY,
198 uint32_t ud_attributes;
204 field contains the name of the directory entry.
208 field specifies whether the entry corresponds to a file or a sub-directory.
212 field is valid for files only, and specifies the file's size in bytes.
216 field describes the file or directory's modification time, specified as
217 seconds from the Unix epoch.
218 The timestamp is relative to the current timezone, so
220 can be used to convert it into human readable form.
221 Note that the Toppy sets directory timestamps to a predefined value so
222 they are not particularly useful.
226 field is not used at this time.
227 .It UTOPPYIOREADFILE Fa "struct utoppy_readfile *"
228 This command is used to initiate reading a file from the Toppy's hard disk.
229 The full pathname, together with the file offset at which to start reading,
230 is specified using the following data structure:
232 struct utoppy_readfile {
238 After issuing this command, the file must be read using consecutive
243 returns zero, the entire file has been read.
244 .It UTOPPYIOWRITEFILE Fa "struct utoppy_writefile *"
245 This command is used to initiate writing to a file on the Toppy's hard disk.
246 The file to be written is described using the following data structure:
248 struct utoppy_writefile {
258 field specifies the full pathname of the file to be written.
262 field specifies the file offset at which to start writing, assuming the file
268 The protocol requires that the Toppy must be informed of a file's size in
269 advance of the file being written.
270 This is accomplished using the
273 It may be possible to work around this limitation in a future version of
278 field specifies the file's timestamp expressed as seconds from the Unix epoch
279 in the local timezone.
282 Due to limitations with the protocol, a
284 device can be opened by only one application at a time.
286 .Dv UTOPPYIOREADDIR ,
287 .Dv UTOPPYIOREADFILE ,
289 .Dv UTOPPYIOWRITEFILE
290 command can be in progress at any given time.
292 .Bl -tag -width /dev/utoppy0 -compact
306 .An Steve C. Woodford Aq scw@netbsd.org