lib/master.c
changeset 1911 460baca4df83
parent 1804 742607c464c4
child 1913 cbef34ba142b
equal deleted inserted replaced
1910:9a741a3d01bb 1911:460baca4df83
   262     download.sdo_entry_subindex = subindex;
   262     download.sdo_entry_subindex = subindex;
   263     download.data_size = data_size;
   263     download.data_size = data_size;
   264     download.data = data;
   264     download.data = data;
   265 
   265 
   266     if (ioctl(master->fd, EC_IOCTL_SLAVE_SDO_DOWNLOAD, &download) == -1) {
   266     if (ioctl(master->fd, EC_IOCTL_SLAVE_SDO_DOWNLOAD, &download) == -1) {
   267         if (errno == -EIO) {
   267         if (errno == EIO && abort_code) {
   268             if (abort_code) {
   268             *abort_code = download.abort_code;
   269                 *abort_code = download.abort_code;
       
   270             }
       
   271         }
   269         }
   272         fprintf(stderr, "Failed to execute SDO download: %s\n",
   270         fprintf(stderr, "Failed to execute SDO download: %s\n",
   273             strerror(errno));
   271             strerror(errno));
   274         return -1;
   272         return -1;
   275     }
   273     }
   290     upload.sdo_entry_subindex = subindex;
   288     upload.sdo_entry_subindex = subindex;
   291     upload.target_size = target_size;
   289     upload.target_size = target_size;
   292     upload.target = target;
   290     upload.target = target;
   293 
   291 
   294     if (ioctl(master->fd, EC_IOCTL_SLAVE_SDO_UPLOAD, &upload) == -1) {
   292     if (ioctl(master->fd, EC_IOCTL_SLAVE_SDO_UPLOAD, &upload) == -1) {
   295         if (errno == -EIO) {
   293         if (errno == EIO && abort_code) {
   296             if (abort_code) {
   294             *abort_code = upload.abort_code;
   297                 *abort_code = upload.abort_code;
       
   298             }
       
   299         }
   295         }
   300         fprintf(stderr, "Failed to execute SDO upload: %s\n",
   296         fprintf(stderr, "Failed to execute SDO upload: %s\n",
   301                 strerror(errno));
   297                 strerror(errno));
   302         return -1;
   298         return -1;
   303     }
   299     }