|
From: Tao W. <twa...@gm...> - 2016-01-19 03:20:58
|
On 18 January 2016 at 23:42, Joerg Schilling <Joe...@fo...> wrote: > > > Libscg is the most portable solution you may find. > > OS X is the only non-orthogonal OS in the list of supported OS. Note that > libscg supports aprox. 30 different OS types. > > Does your project already work on more than one platform? > If yes, how does it implement this feature? We generalized the API we need, such as 'scsi_read()' and 'scsi_write()', then, implemented those API for Linux and Windows separately. Here is the implementation: https://github.com/asalamon74/pktriggercord/blob/master/pslr_scsi_linux.c https://github.com/asalamon74/pktriggercord/blob/master/pslr_scsi_win.c So, basically, we use '/sys/class/scsi_generic' with 'ioctl()' for Linux, and 'DeviceIoControl()' with 'IOCTL_SCSI_PASS_THROUGH_DIRECT' for Windows. > BTW: If you ever write an own driver or if you find somebody who did or who is > willing to do this for you, please keep me informed as I would be interested to > use this for better OS X support in libscg. > > Jörg There are 2 driver candidates I might look into if I'm going to implement my own OSX kernel driver. The first one is the blog written by Joel Reymont: http://wagerlabs.com/blog/2008/02/04/writing-a-mac-osx-usb-device-driver-that-implements-scsi-pass-through/ And here is the code for it: https://github.com/wagerlabs/seaforth24 Another one is 'OS-X-SAT-SMART-Driver' written for 'smartmontools': https://github.com/kasbert/OS-X-SAT-SMART-Driver I hope these will help. Best Regards, Tao Wang |