Commit graph

42 commits

Author SHA1 Message Date
Amaury Pouly
df8b817c96 nwztools/scsitool: fix incorrect declaration in header file
Change-Id: I10727311db4747a66b3ae7f72a92a64cc99dfc82
2020-10-15 23:03:15 +02:00
Amaury Pouly
05fa8fc343 scsitools: typo
Change-Id: I0f4e5b6c5e88a1ae49102e6f6fc6f8c86cb63959
2020-10-11 13:08:03 +02:00
Amaury Pouly
cda16f9439 scsitools: const correctness and add "get_dnk_nvp all" subcommand.
Change-Id: Ic5cb3dfa3be684f31a2c55a3cb7d45cfe8c65b25
2020-10-11 13:08:03 +02:00
Amaury Pouly
76fbb33adf nwztools: fix MW-WM1/A30 KAS, fix KAS length
Split WM1A/WM1Z because they don't have the same KAS. On newer devices, the KAS
is actually 64 bytes, not 60. The strange thing is that "get_dnk_nvp kas" returns
60 bytes whereas "get_dnk_prop kas" returns 64, not sure why.

Change-Id: I944d3d838209ba58388439af0cdf5d7c74f1f7fc
2020-10-11 13:08:03 +02:00
Amaury Pouly
fba4df5d6d nwztools/scsitool: add command to write NVP
Change-Id: I4a7a9688af1abb14de82013703f3a02b4644d5ed
2020-05-27 23:39:06 +02:00
Amaury Pouly
47104e9e51 nwztools/scsitool: add preliminary code to decode SCSI requests
This can be useful to quickly device usb traces

Change-Id: I843fbd5280f11686ea810b44ffb1414e844ebcf9
2020-05-17 20:21:13 +02:00
Amaury Pouly
ae6a49638b nwztools/scsitool: add more NVP properties
At least newer devices support more NVP properties in a device-independent
numbering. Many are supported but I just added two useful ones

Change-Id: I57926de7f0dd364b46a57ca8d48a5c4d4f20402b
2020-05-17 20:21:12 +02:00
Amaury Pouly
f86723716c nwztools/scsitool: add alternative firmware upgrade command
Newer devices seem to require flags 0x00 where older devices wanted 0x80, now
try both variants

Change-Id: Ifeee641052857c66c1b64860d7309a235021a168
2020-05-17 20:21:12 +02:00
Amaury Pouly
1686093e78 nwztools/scsitool: tweak output
Change-Id: I43c5101502f3d2c34296b510b738276fd74f9b3d
2020-05-17 20:21:12 +02:00
Amaury Pouly
392db31d90 sonynwz/scsitools: fix string buffer size
Change-Id: I8997e7c3791b805a70a30cd1209a69b7afbec1e7
2020-01-29 13:26:42 +01:00
Amaury Pouly
9e94a5eadc nwztools/scsitool: fix out of buffer access
Change-Id: Ib2c25dd21d39fda026e008950a805f032c916a72
2020-01-12 23:11:59 +01:00
Amaury Pouly
fbad457339 nwztools/scsitools: simplify code and enable O2
Change-Id: Ic14bc5ff643c9cf4c6380b4c34999d704c65e460
2020-01-12 21:42:23 +01:00
Amaury Pouly
4ed5727654 nwztools: fix Makefile
Seems like newer versions of mingw will sponteanously add a .exe suffix to
the output path if it doesn't have one, for example mingw-gcc -o scsitool bla
will actually create scsitool.exe and of course this breaks my release script.
Fix this by explicitely adding the .exe to avoid any problem

Change-Id: Ic8019b968b532b2ca612ba0c03977a96c22cee01
2019-04-22 23:45:33 +02:00
Amaury Pouly
4c318057f6 nwzstools/scsitool: try to guess series if possible
If the model is not known (ie model ID in the database) but another device from
the same series is known, then the database information probably applies and
one can use the "force" option -s to tell the tool to ignore the model ID.
Automatically print such advice when the series can be guessed.

Change-Id: I6bcc7aa29693df8c3d7d8e709ece7cea650be717
2018-11-30 15:37:10 +01:00
Amaury Pouly
da752d0084 nwztools/scsitool: add experimental command to list Sony devices
Change-Id: Ic4f382667c5c84514be661d36032c47fb8f92e75
2018-11-30 15:37:10 +01:00
Amaury Pouly
4365437159 Indentation fix
Change-Id: Ia0f96dd27c520cf2bfec4765619f53eaffee3e20
2018-11-30 15:37:10 +01:00
Amaury Pouly
11437662c4 nwztools/scsitool: fix completely stupid code
Change-Id: I3771388d24fe5fa249dcb40b231d7a4e06d3c3c8
2018-01-13 19:12:43 +01:00
Amaury Pouly
4d988d43d8 nwztools/scsitool: print clearer message when nvp info is incomplete
Change-Id: I13b20b88b35e825da929a31e71ff42d68a79f131
2018-01-13 12:18:01 +01:00
Amaury Pouly
07d3b3c1fb nwztools/scsitools: print device list when listing series
Change-Id: Ic46c724c5d89a775dc20853410c8fe6f0ff9a4c8
2017-11-01 12:43:33 +01:00
Amaury Pouly
1eab18c9e4 nwztools/scsitools: don't try to get nodes when we don't know about the device
Change-Id: Id35671f1e039a94e2b319262e4faa51d73f12afd
2017-10-17 13:34:54 +02:00
Amaury Pouly
9a8a52cb07 nwztools/scsitool: slightly rework of help_us and help
Now print list of devices immediately even if the rest of the command line
is empty (ie 'scsitool -s ?' works, whereas before one would need an actual
device to even get a list). Add more information in the help_us command:
print kas, lyr and fpi.

Change-Id: Icfeeaeebe28c774a74ca54661357fafa25c3d114
2017-10-17 13:05:58 +02:00
Amaury Pouly
2f3801be34 fix typo
Change-Id: Ic357f82d61cc0004ac6193fa9dbbc90976042574
2017-10-06 18:31:11 +02:00
Amaury Pouly
d9da4833a7 nwztools/scsitool: various improvements
The tool now provides more useful information for developers when the device
is not supported. Is also has a new verb "help_us" that also prints all this
information (notably the device info and model ID).

Change-Id: I04baec8fff23eb83a0408add6296b5d42e9aa8e7
2017-10-06 12:10:40 +02:00
Amaury Pouly
5f4de5bf48 nwztools/scsitools: make do_fw_upgrade output less confusing
Change-Id: If616e646aeddf20aa3cee79a821a420d9102c708
2017-09-19 21:53:52 +02:00
Amaury Pouly
1d121e8c08 Initial commit for the Sony NWZ linux port
SUPPORTED SERIES:
- NWZ-E450
- NWZ-E460
- NWZ-E470
- NWZ-E580
- NWZ-A10

NOTES:
- bootloader makefile convert an extra font to be installed alongside the bootloader
  since sysfont is way too small
- the toolsicon bitmap comes from the Oxygen iconset
- touchscreen driver is untested

TODO:
- implement audio routing driver (pcm is handled by pcm-alsa)
- fix playback: it crashes on illegal instruction in DEBUG builds
- find out why the browser starts at / instead of /contents
- implement radio support
- implement return to OF for usb handling
- calibrate battery curve (NB: of can report a battery level on a 0-5 scale but
  probabl don't want to use that ?)
- implement simulator build (we need a nice image of the player)
- figure out if we can detect jack removal

POTENTIAL TODOS:
- try to build a usb serial gadget and gdbserver

Change-Id: Ic77d71e0651355d47cc4e423a40fb64a60c69a80
2017-09-05 21:42:12 +02:00
Amaury Pouly
37a945d203 nwztools/scsitool: add a command to query multiple nvp nodes at once
Change-Id: I89fed904b282a202bc845b08f4c8d1200a49636d
2017-06-18 23:16:18 +02:00
Amaury Pouly
91ede1ea08 nwztools/scsitool: fix devinfo, add dhp
The devinfo request returned the raw data, now the tool prints the various
fields. Also add support for the dhp (destination/headphones/color ...): this
one is untested because it's only supported starting from A10 or A20. There is
still a problem with the dpcc prop: although it should work for DEVINFO, it does
not, despite the fact that the get_dev_info command works and is internally (on
the Sony) translated into a dpcc request. I keep the code just in case.

Change-Id: I5aa8ef4afb0b11d3c0ddfa3d38f3e737ee1aff66
2017-06-18 13:37:26 +02:00
Amaury Pouly
8d5dcd395d nwztools/scsitool: print error on check sense
The detailled error message is only printed if -d switch is on command line,
otherwise there is no error message which is wrong so fix that.

Change-Id: I397541c467940e9b290ee8d4ae704368b1ce132b
2017-06-18 13:35:42 +02:00
Amaury Pouly
1d7f6048f4 nwztools: add a "reset all settings" message in dest_tool
Users can't read the wiki instructions, hopefully they can read this...

Change-Id: I3840879fdc663fb6e7f9234f352eea04a556256a
2017-01-09 22:15:53 +01:00
Amaury Pouly
9b2fab1ca9 Makefile cleanups
Change-Id: I69b8b81d357553c979682d42097eba864c951512
2017-01-08 16:08:28 +01:00
Amaury Pouly
1895af8e15 nwztools/scitool: rework node size, remove relaxed mode
The cool now takes the database as a hint and will not complain if the device
returns less data. The tool also supports user provided size and raw node numbers
that are not in the database (advanced usage).

Change-Id: I8cec536718d7eff01c7803bea648d6122b82377a
2017-01-08 16:07:18 +01:00
Amaury Pouly
76c73c707a nwztools/scsitools: use new SCSI library
Change-Id: I1b5688ba7ad99c7a22ba4532c8237b4563e4a9e4
2017-01-07 16:31:28 +01:00
Amaury Pouly
86e745a25e nwztools/scsitool: add relaxed mode for nvp
Change-Id: I0a139eb236f825368ae627fdbb2f75286f747f10
2017-01-07 15:53:03 +01:00
Amaury Pouly
456a3fc952 imxtools: various fixes for Windows
Don't use colors since the terminal doesn't support it. Also packing is broken
on MinGW so use #pragma pack when compiling for windows, this is also supported
by MSCV.

Change-Id: I635649d52ed5f2e0af46cb9ca2ec325955b2ddb2
2017-01-07 15:52:33 +01:00
Amaury Pouly
ad2297d353 nwztools/scsitool: add option to force/specify series
We cannot auto-detect a device if we don't know its model ID, but we can't know
the model ID if we haven't decrypted the upgrade which requires the key. The only
way to solve this chicken-and-egg problem is to get the NVP table from kernel,
create an empty series in the database (no model ID), then get the key using
scsitool and forcing the model (using this commit), then decrypt the upgrade
and get the model ID list.

Change-Id: I8eced486a5f6a1a99028b25fdc4f87a3b11e31a8
2017-01-04 17:14:31 +01:00
Amaury Pouly
33856d9ceb nwztool/scsitools: cleanup and add destination changer tool
Now that we have a nice database of player index, the scsitool becomes more
useful and supports a lot more players. I did some general cleanup of the code,
though eventually it would be nice to really split it into a library and a CLI.
The SCSI vendor command allow to read but also write most NVP nodes. Since there
seems to a demand to change destination and sound pressure settings on device,
I implement this feature in the tool. I do not plan to allow arbitrary NVP
writes because this could easily brick the device. Changing the destination
should be safe, but as usual, use at your own risks.

Change-Id: Iff4e8cc3ac97b965c1df849051c5fd373756cda5
2016-11-11 16:07:14 +01:00
Amaury Pouly
b9923df170 imxtools/nwztools: fix compilation for windows
There is a windows port of the sg_utils library for scsi pass-
through. This little changes make it compile under mingw. A better
fix would be to implement direct ioctl on both windows and linux
but that's already better than nothing

Change-Id: I0d77cd1bad69806a66f0590362f165f24fa240e9
2013-01-10 00:51:35 +00:00
Amaury Pouly
fb05b3e698 newtools/scsitool: fix typo
Change-Id: I882956c0022db846882c68f8aac7f9d8fe49dfa8
2012-12-11 20:20:49 +01:00
Amaury Pouly
02f67224f9 scsitools: add nwz firmware upgrade scsi command
Change-Id: Iaebb442611c64fe4d47a07ce3b3d12c3230cafe5
2012-11-13 18:25:00 +01:00
Amaury Pouly
99f20b85f6 nwztools: various fix and enhancements
Change-Id: Iaa89df27b7a0c4eb9fc6603c431de3d1fe791fa1
2012-11-03 14:04:27 +01:00
Amaury Pouly
6d04ed343c scsi_tools: add support for nvp reading
There is a vendor specific command to read the NVP of the device,
including the KAS. The trick is that the data is randomly
scrambled using a so-called para_noise array of random values.
There seems to be a problem when retrieving large entries (>1000
bytes typically) which causes sg_pt do behave strangely.

Change-Id: Iefa6140df78ab9c7dcf7ac34cb1170979123ecd7
2012-11-03 04:25:25 +01:00
Amaury Pouly
3e1c492680 Introduce scsitool for sony nwz players
This tool can send vendor specific scsi commands to sony nwz
players such as getting serial number, model id, device info,
and others. It can potentially be used to get some private keys
stored on the device but probably not the KAS used to encrypt
firmware upgrades images(UPG).

Change-Id: Ia49c1edf8d421b20c4e9afeb1192e00e06eb6047
2012-11-03 02:29:00 +01:00