Bitsetting not working under linux?

vbimport

#1

Hi all!

Firstly great thanks for great work on NEC firmware! Today I bought a NEC ND 3520A and I can’t seem to be able to set bitset. I downloaded http://www.micheldeboer.nl/firmware/LD3520_1U7.zip. Flashed my firmware successfully and :

[~/Nec]> sudo ./necflash -s -scan
Binflash - NEC version - © by Herrie and Liggy
Visit http://binflash.cdfreaks.com - http://www.herrie.org

List of supported devices:

Device : /dev/hdd
Vendor : _NEC
Model : DVD_RW ND-3520A
Firmware : 1.U7

[~/Nec]> sudo ./necflash -s -setbt DVD+R DVD-ROM perm /dev/hdd
Binflash - NEC version - © by Herrie and Liggy
Visit http://binflash.cdfreaks.com - http://www.herrie.org

Drivetype could not be determined

Here is the strace info for relevant part :

open("/dev/hdd", O_RDONLY|O_NONBLOCK) = 3
ioctl(3, SG_GET_VERSION_NUM, 0xbffff1b4) = 0
ioctl(3, SG_IO, 0x80ba2f8) = 0
ioctl(3, SG_IO, 0x80ba2f8) = 0
close(3) = 0
write(2, “Drivetype could not be determine”…, 34Drivetype could not be determined
) = 34
munmap(0xb7fff000, 4096) = 0
exit_group(12) = ?

===============================

System info :
Linux kernel 2.6.11 vanilla from kernel.org

Also note that I run program through sudo so I got write access to device.


#2

It’s hard to tell the exact reason, but something on your PC seems to prevent Binflash from sending a command that reads a specific flash region to determine your drivetype. I’ve read some threads that this may be related to the used kernel version.

Unfortunately there’s nothing I can change in my program, as it’s something else that prevents the flasher from sending the necessary commands to the drive.


#3

Hi Liggy,

if you can send me the relevant part of your code ( only the part that does ioctl & error check ) I can try to find if kernel is buggy.

Thanks,
ismail


#4

Also note that flashing works so I bet there is something wrong with the code…


#5

Drivetype could not be determined

This is the same error given when using the windows counterpart. Try to use something else to set the booktype.


#6

I have no Windows installed so what would be alternative?


#7

The relevant code for sending ioctl’s was not written by me. You can check fPLSCSI yourself from here.


#8

I have no Windows installed so what would be alternative?
Well, another linux software package, if there is one that works. It’s been a long while since I played with linux, but how about dvd+rw-tools? It seems to be pretty popular, shouldn’t be hard to find a binary package that works with your installation. The command would be something like “dvd+rw-booktype -dvd-rom -unit+r /dev/hdd” for you. Might not work, but worth a try.


#9

[cartman@southpark][13:25:01]
[~]> sudo dvd+rw-booktype -dvd-rom -unit+r /dev/hdd
:-[ RICOH(14h) failed with SK=5h/ASC=20h/ACQ=00h]: No such device

:frowning:


#10

Well, like I said everything linux related is a faded memory for me, but the tutorial for dvd+rw-tools mentions routing the command through the ide-scsi emulation, specifically

If you have an IDE unit and run 2.4.x kernel, you most likely want to “route” it through ide-scsi emulation layer by either:

* passing "hdX=ide-scsi" argument to kernel;
* appending following lines to your /etc/modules.conf:

options ide-cd ignore=hdX
pre-install sg modprobe ide-scsi
pre-install sr_mod modprobe ide-scsi
pre-install ide-scsi modprobe ide-cd

Keep in mind that once hdX is routed through ide-scsi, you can no longer refer to /dev/hdX(*), but to corresponding /dev/scdN only.
I know you have 2.6 kernel but the doc might be outdated.


#11

These DVD+RW tools only support Ricoh style bitsetting, but newer firmwares use their own NEC style command set for booktype changes and that one is not supported (yet?).


#12

Then I guess it doesn’t work. Too bad.


#13

Thank you for your help but 2.6 kernel no longer uses ide-scsi interface for cd/dvd writing it now directly uses ide interface. Liggy suspects that real problem might be the fact that since 2.6.9 kernel some scsi commands are filtered ( those known to be dangerous ) . I don’t know if those are filtered for root but I guess not. I am out of any clue for now.


#14

One other weird thing here is this :

ioctl(3, SG_IO, 0x80ba2f8) = 0
ioctl(3, SG_IO, 0x80ba2f8) = 0

Those ioctl commands return 0 which means ioctl succeeded but the program gives an error. Maybe a wrong if check there ( low possibility I know … ) ?


#15

Found the bug. New version 1.12 will be published soon. Probably nobody was ever able to change the booktype on 3520 (and compatible) drives with binflash. Searching for a big hole to hide


#16

You might want to lock this topic and make it sticky ;). Cheers for great work!


#17

With 1.12 -setbt works fine but -querybt says :

[~]> sudo ./necflash -s -querybt /dev/hdd
Binflash - NEC version - © by Herrie and Liggy
Visit http://binflash.cdfreaks.com - http://www.herrie.org

Currently no disc is inserted
The permanent booktype on DVD+R either has not been set or cannot be changed
The permanent booktype on DVD+RW either has not been set or cannot be changed
The permanent booktype on DVD+R-DL cannot be changed

A similar fix needed?


#18

When I put a dvd in. I get this :

[cartman@southpark][16:10:32]
[~/Nec]> sudo ./necflash -s -setbt DVD+R DVD-ROM perm /dev/hdd
Binflash - NEC version - © by Herrie and Liggy
Visit http://binflash.cdfreaks.com - http://www.herrie.org

[cartman@southpark][16:10:36]
[~/Nec]> sudo ./necflash -querybt /dev/hdd
Binflash - NEC version - © by Herrie and Liggy
Visit http://binflash.cdfreaks.com - http://www.herrie.org

The current disctype is DVD+R
The current booktype is DVD+R
The permanent booktype on DVD+R either has not been set or cannot be changed
The permanent booktype on DVD+RW either has not been set or cannot be changed
The permanent booktype on DVD+R-DL cannot be changed

Something going wrong here?


#19

Nope. That must be something different. The drivetype is not checked here, I just issue NEC style commands first and if these fail I use the Ricoh one. What does strace tell you?


#20

Ok first I assume you read http://club.cdfreaks.com/showpost.php?p=902238&postcount=18 is that normal? That DVD was written before I set to DVD-ROM so I guess its ok it shows book type as DVD+R ?

Here is output of beloved strace :slight_smile: :

open("/dev/hdd", O_RDWR|O_NONBLOCK) = 3
ioctl(3, SG_GET_VERSION_NUM, 0xbffff1c0) = 0
ioctl(3, SG_IO, 0x80c22f8) = 0
write(1, "The current disctype is DVD+R
", 30The current disctype is DVD+R
) = 30
ioctl(3, SG_IO, 0x80c22f8) = 0
write(1, "The current booktype is DVD+R
", 30The current booktype is DVD+R
) = 30
ioctl(3, SG_IO, 0x80c22f8) = 0
ioctl(3, SG_IO, 0x80c22f8) = 0
write(1, “The permanent booktype on DVD+R “…, 77The permanent booktype on DVD+R either has not been set or cannot be changed
) = 77
ioctl(3, SG_IO, 0x80c22f8) = 0
ioctl(3, SG_IO, 0x80c22f8) = 0
write(1, “The permanent booktype on DVD+RW”…, 78The permanent booktype on DVD+RW either has not been set or cannot be changed
) = 78open(”/dev/hdd”, O_RDWR|O_NONBLOCK) = 3
ioctl(3, SG_GET_VERSION_NUM, 0xbffff1c0) = 0
ioctl(3, SG_IO, 0x80c22f8) = 0
write(1, "The current disctype is DVD+R
", 30The current disctype is DVD+R
) = 30
ioctl(3, SG_IO, 0x80c22f8) = 0
write(1, "The current booktype is DVD+R
", 30The current booktype is DVD+R
) = 30
ioctl(3, SG_IO, 0x80c22f8) = 0
ioctl(3, SG_IO, 0x80c22f8) = 0
write(1, "The permanent booktype on DVD+R "…, 77The permanent booktype on DVD+R either has not been set or cannot be changed
) = 77
ioctl(3, SG_IO, 0x80c22f8) = 0
ioctl(3, SG_IO, 0x80c22f8) = 0
write(1, “The permanent booktype on DVD+RW”…, 78The permanent booktype on DVD+RW either has not been set or cannot be changed
) = 78
ioctl(3, SG_IO, 0x80c22f8) = 0
write(1, “The permanent booktype on DVD+R-”…, 53The permanent booktype on DVD+R-DL cannot be changed
) = 53
ioctl(3, SG_IO, 0x80c22f8) = 0
ioctl(3, SG_IO, 0x80c22f8) = 0
ioctl(3, SG_IO, 0x80c22f8) = 0
close(3) = 0

ioctl(3, SG_IO, 0x80c22f8) = 0
write(1, “The permanent booktype on DVD+R-”…, 53The permanent booktype on DVD+R-DL cannot be changed
) = 53
ioctl(3, SG_IO, 0x80c22f8) = 0
ioctl(3, SG_IO, 0x80c22f8) = 0
ioctl(3, SG_IO, 0x80c22f8) = 0
close(3) = 0