Skip to content
Snippets Groups Projects
Select Git revision
  • 0b544a4c9b0b0e899c882b38c53cdd65fdf871b2
  • master default
2 results

test_2d_plot.py

Blame
  • Forked from finesse / pykat
    Source project has a limited visibility.
    scsicmds.c 25.38 KiB
    /*
     * scsicmds.c
     *
     * Home page of code is: http://smartmontools.sourceforge.net
     *
     * Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
     * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation; either version 2, or (at your option)
     * any later version.
     *
     * You should have received a copy of the GNU General Public License
     * (for example COPYING); if not, write to the Free
     * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     *
     * This code was originally developed as a Senior Thesis by Michael Cornwell
     * at the Concurrent Systems Laboratory (now part of the Storage Systems
     * Research Center), Jack Baskin School of Engineering, University of
     * California, Santa Cruz. http://ssrc.soe.ucsc.edu/
     *
     */
    
    #include <stdio.h>
    #include <string.h>
    #include <getopt.h>
    #include <unistd.h>
    #include <sys/ioctl.h>
    #include <linux/hdreg.h>
    /* #include <scsi/scsi.h>	bypass for now */
    /* #include <scsi/scsi_ioctl.h> bypass for now */
    #include "scsicmds.h"
    
    const char *scsicmds_c_cvsid="$Id: scsicmds.c,v 1.18 2003/01/16 15:28:57 ballen4705 Exp $" SCSICMDS_H_CVSID;
    
    static int send_scsi_cmd(int device, int cmnd_len, void * io_hdr)
    {
        	int status;
    
    #ifdef SCSI_DEBUG
    	{
    		int k;
    		const unsigned char * ucp = io_hdr;
    
    		ucp += 2 * sizeof(int);
    		fprintf(stderr, "cmnd: [");
    		for (k = 0; k < cmnd_len; ++k)
    			fprintf(stderr, "%02x ", ucp[k]);
    	}
    #endif
    	status =  ioctl(device, SCSI_IOCTL_SEND_COMMAND , io_hdr);
    #ifdef SCSI_DEBUG
    	fprintf(stderr, "] status=0x%x\n", status);
    #endif
    	return status;
    }
    
    UINT8 logsense (int device, UINT8 pagenum, UINT8 *pBuf)
    {
      struct cdb10hdr *ioctlhdr;
      UINT8 tBuf[1024 + CDB_12_HDR_SIZE];
      UINT8 status;
    
      
      memset ( &tBuf, 0, 255);
        
      ioctlhdr = (struct cdb10hdr *) &tBuf;
      
      ioctlhdr->inbufsize = 0;