@@ -75,20 +75,17 @@ def file_handle( self, path, mode, reopen=False ):
7575
7676 return f
7777
78- def read (self , path , size = - 1 ):
78+ def read (self , path ):
7979 f = self .file_handle (path , 'r' )
8080
8181 try :
8282 f .seek (0 )
83- value = f .read (size )
83+ value = f .read ()
8484 except IOError :
8585 f = self .file_handle ( path , 'w+' , reopen = True )
86- value = f .read (size )
86+ value = f .read ()
8787
88- if size < 0 :
89- return value .strip ()
90- else :
91- return value
88+ return value .strip ()
9289
9390 def write (self , path , value ):
9491 f = self .file_handle ( path , 'w' )
@@ -159,9 +156,9 @@ def _matches(self, attribute, pattern):
159156 else :
160157 return value .find (pattern ) >= 0
161158
162- def _get_attribute ( self , attribute , size = - 1 ):
159+ def _get_attribute ( self , attribute ):
163160 """Device attribute getter"""
164- return self ._attribute_cache .read (abspath (self ._path + '/' + attribute ), size )
161+ return self ._attribute_cache .read (abspath (self ._path + '/' + attribute ))
165162
166163 def _set_attribute ( self , attribute , value ):
167164 """Device attribute setter"""
@@ -1293,7 +1290,9 @@ def bin_data(self, fmt=None):
12931290 "float" : 4
12941291 }.get (self .bin_data_format , 1 ) * self .num_values
12951292
1296- raw = bytearray (self ._get_attribute ('bin_data' , self ._bin_data_size ))
1293+ f = self ._attribute_cache .file_handle (abspath (self ._path + '/bin_data' ), 'rb' )
1294+ f .seek (0 )
1295+ raw = bytearray (f .read (self ._bin_data_size ))
12971296
12981297 if fmt is None : return raw
12991298
0 commit comments